Every time i build something with Mavent i muss struggle with the searching a proper repo for the required Maven artifact. As now i am searching the repo for the spring-aop but can not find one. Actual pom.xml follows.
How can i approach assembling pom.xml properly?
Thanks.
<repositories>
<repository>
<id>springsource-milestone</id>
<url>http://maven.springframework.org/milestone</url>
</repository>
<repository>
<id>org.springframework.repository.maven</id>
<name>SpringSource Maven Repository</name>
<url>http://repository.springframework.org/maven/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.aop</artifactId>
<version>3.1.1.RELEASE</version>
</dependency>
</dependencies>
The artifact spring-aop is present in maven central repo.
Normally most of the released artifacts are present in maven central which need not be explicitly specified in pom.xml. You can use the search option of the central repo for this.
In the question above, you would need to include the additional spring repos only if you were looking for milestone (alpha/beta) releases.
I would recommend to use a repository manager instead of added repositories to the pom.
Related
this is my environment.
java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)
Apache Maven 3.5.4
Nexus 2.14.8-01
Jenkins 2.136
my issue is I cannot perform a mvn clean deploy in Jenkins without it issuing error. the error:
[WARNING] The POM for org.apache.maven.plugins:maven-deploy-plugin:jar:2.7 is missing, no dependency information available
[ERROR] Plugin org.apache.maven.plugins:maven-deploy-plugin:2.7 or one of its dependencies could not be resolved: Failure to find org.apache.maven.plugins:maven-deploy-plugin:jar:2.7 in http://137.27.68.182:8082/nexus/content/groups/public was cached in the local repository, resolution will not be reattempted until the update interval of ge-ip-nexus has elapsed or updates are forced -> [Help 1]
I'm rather new, and each experience brings me closer, but, I'm baffled.
In Nexus Maven Central, I look in Nexus repo, and under Browse Index, the maven-deploy-plugin:jar:2.7 exists, however, under browse storage, only 2.8.2 exists.
I'm not specifying or to my knowledge a specific version and wonder why doesn't it just use the maven-deploy-plugin:jar:2.8.2 ??? instead of the 2.7. and I can't find where the 2.7 is being declared. ??
thank you any suggestions on how to resolve or explain what the heck is going on would be much appreciated, IOU beer and more beer. :)
SETTINGS FOR JENKINS
<settings
xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<!-- The path to the local repository -->
<localRepository>/Users/212555427/devel/maven/repositories/ge-ip-jenkins-repository</localRepository>
<offline>false</offline>
<servers>
<server>
<id>com.ge.ip.snapshot.local</id>
<username>xxxxx</username>
<password>xxxxxx</password>
</server>
</servers>
<mirrors>
<mirror>
<id>ge-ip-nexus</id>
<name>Nexus Repository Manager</name>
<mirrorOf>*,!jbossRepos(x)</mirrorOf>
<url>http://137.277.686.182:8082/nexus/content/groups/public</url>
</mirror>
</mirrors>
<profiles>
<!-- A definition of a development profile -->
<profile>
<id>development</id>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>com.ge.ip.release</id>
<name>Release Repository</name>
<url>http://137.277.686.182:8082/nexus/content/groups/public</url>
</repository>
<!-- The specified location of where all snapshot artifacts are retrieved from. -->
<repository>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>com.ge.ip.snapshot</id>
<name>Snapshot Repository</name>
<url>http://137.277.686.182:8082/nexus/content/groups/public</url>
</repository>
</repositories>
<pluginRepositories>
<!-- The specified location of where all released plugins are retrieved from. -->
<pluginRepository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>com.ge.ip.plugin.release</id>
<name>Plugin Release Repository</name>
<url>http://137.277.686.182:8082/nexus/content/groups/public</url>
</pluginRepository>
<!-- The specified location of where all snapshot plugins are retrieved from. -->
<pluginRepository>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>com.ge.ip.plugin.snapshot</id>
<name>Plugin Snapshot Repository</name>
<url>http://137.277.686.182:8082/nexus/content/groups/public</url>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<!-- Specify the default active profile. -->
<activeProfiles>
<activeProfile>development</activeProfile>
</activeProfiles>
</settings>
POM:
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.ge.digital.fleet</groupId>
<artifactId>ge.digital.fleet.parent</artifactId>
<version>1.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>DIGITAL Fleet Parent</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<compiler.source.version>1.8</compiler.source.version>
<compiler.target.version>1.8</compiler.target.version>
<!-- JBoss Fuse Properties -->
<jboss.fuse.bom.version>6.3.0.redhat-310</jboss.fuse.bom.version>
<jboss.fuse.install>6.3.0.redhat-310</jboss.fuse.install>
<!-- Versions pulled from JBoss Fuse BOM for Dependency Management. -->
<cxf-version>2.17.0.redhat-630310</cxf-version>
<camel-version>2.17.0.redhat-630310</camel-version>
<activemq-version>5.11.0.redhat-630310</activemq-version>
<karaf-version>2.4.0.redhat-630310</karaf-version>
<hawtio-version>1.4.0.redhat-630310</hawtio-version>
<fabric-version>1.2.0.redhat-630310</fabric-version>
<junit-version>4.11</junit-version>
<log4j-version>1.2.17</log4j-version>
<velocity-bundle-version>2.17.0.redhat-630310</velocity-bundle-version>
<velocity-version>2.17.0.redhat-630310</velocity-version>
<joda-time-version>2.9.2</joda-time-version>
<!-- Versions of 3rd Party Dependencies -->
<ibm-mq-version>7.5.0.8</ibm-mq-version>
<!-- Test Dependencies -->
<ftpserver-version>1.0.6</ftpserver-version>
<sshd-version>0.10.0</sshd-version>
<greenmail-version>1.4.0</greenmail-version>
<!-- Plugin Versions-->
<version.maven-compiler-plugin>2.5.1</version.maven-compiler-plugin>
<bundle-plugin-version>2.3.7</bundle-plugin-version>
<build-helper-plugin-version>1.8</build-helper-plugin-version>
<resources-plugin-version>2.4.3</resources-plugin-version>
<felix-bundle-plugin-version>2.3.7</felix-bundle-plugin-version>
<lifecycle-mapping-version>1.0.0</lifecycle-mapping-version>
<maven-failsafe-plugin-version>2.8.1</maven-failsafe-plugin-version>
<depends-maven-plugin-version>1.2</depends-maven-plugin-version>
</properties>
<dependencyManagement>
<dependencies>
<!-- Import Fuse Dependency Management via BOM -->
<dependency>
<groupId>org.jboss.fuse.bom</groupId>
<artifactId>jboss-fuse-parent</artifactId>
<version>${jboss.fuse.bom.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>jcifs</groupId>
<artifactId>jcifs</artifactId>
<version>1.3.17</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>${joda-time-version}</version>
</dependency>
<!-- Spring Dependencies -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>4.0.4.RELEASE</version>
</dependency>
<dependency>
<groupId>com.mchange</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.2.1</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.7.21</version> <!-- 5.7.21 5.1.27-->
</dependency>
<dependency>
<groupId>org.apache.servicemix.bundles</groupId>
<artifactId>org.apache.servicemix.bundles.dom4j</artifactId>
<version>1.6.1_5</version>
</dependency>
<dependency>
<groupId>org.apache.servicemix.bundles</groupId>
<artifactId>org.apache.servicemix.bundles.poi</artifactId>
<version>3.9_2</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>3.9</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.9</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-quartz</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-bindy</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-http4</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-jackson</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>4.3.1</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-csv</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
</dependencies>
<build>
<defaultGoal>install</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${version.maven-compiler-plugin}</version>
<configuration>
<source>${compiler.source.version}</source>
<target>${compiler.target.version}</target>
</configuration>
</plugin>
</plugins>
</build>
<!--
TODO
The url needs to be updated to the Corporate Nexus Instance.
This includes the hostname, port, and directory structure.
The <id> must match the <server> id in the settings.xml.
The settings.xml will contain the username/password.
Also note that only Jenkins should be doing the deploy, therefore
developer settings.xml SHOULD NOT contain the user name / password
of the <server>
-->
<distributionManagement>
<repository>
<id>com.ge.ip.snapshot.local</id>
<name>GE IP Releases</name>
<url>http://137.277.686.182:8082/nexus/content/repositories/releases</url>
</repository>
<snapshotRepository>
<id>com.ge.ip.snapshot.local</id>
<name>GE IP Snapshots</name>
<url>http://137.277.686.182:8082/nexus/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
</project>
Does a direct download work?
http://137.27.68.182:8082/nexus/content/groups/public/org/apache/maven/plugins/maven-deploy-plugin/2.7/maven-deploy-plugin-2.17.pom
If it doesn't, examine the nexus.log file. You'll likely find the network connection from Nexus to Maven Central isn't working for some reason (e.g., it may be getting blocked by your firewall).
well, the reason for inability to access repos in nexus is due to company vpn security - not sure if it is the proxy or certs at this point.
but, If anyone knows how Maven determines the plugin releases or versions please post an answer. for instance if you simply issue a mvn clean deploy - how does maven know to pick deploy plugin 2.7 or 2.8 ?
thank you!
Specify a version/release for deployment plugin
clean package org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy
I just formatted my laptop, and install everything fresh and new. But now I am unable to start Jira.
Here is the error message I get:
The POM for com.atlassian.plugin:atlassian-spring-scanner-maven-plugin:jar:1.2.6 is missing, no dependency information available
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 2.428s
Finished at: Fri Nov 20 08:18:15 IST 2015
Final Memory: 11M/166M
------------------------------------------------------------------------
Plugin com.atlassian.plugin:atlassian-spring-scanner-maven-plugin:1.2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for com.atlassian.plugin:atlassian-spring-scanner-maven-plugin:jar:1.2.6: Failure to find com.atlassian.plugin:atlassian-spring-scanner-maven-plugin:pom:1.2.6 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.
For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
and this is my pom.xml:
<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-api</artifactId>
<version>${jira.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-annotation</artifactId>
<version>${atlassian.spring.scanner.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-runtime</artifactId>
<version>${atlassian.spring.scanner.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
<version>1.1.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.2-atlassian-1</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.atlassian.plugins.rest</groupId>
<artifactId>atlassian-rest-common</artifactId>
<version>1.0.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.atlassian.sal</groupId>
<artifactId>sal-api</artifactId>
<version>2.6.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-jira-plugin</artifactId>
<version>${amps.version}</version>
<extensions>true</extensions>
<configuration>
<productVersion>${jira.version}</productVersion>
<productDataVersion>${jira.version}</productDataVersion>
<enableQuickReload>true</enableQuickReload>
<enableFastdev>false</enableFastdev>
<instructions>
<Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>
<Export-Package>net.gisnas.jira.mailqueue.api,</Export-Package>
<Import-Package>org.springframework.osgi.*;resolution:="optional",
org.eclipse.gemini.blueprint.*;resolution:="optional", *</Import-Package>
<Spring-Context>*</Spring-Context>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-maven-plugin</artifactId>
<version>1.2.6</version>
<executions>
<execution>
<goals>
<goal>atlassian-spring-scanner</goal>
</goals>
<phase>process-classes</phase>
</execution>
</executions>
<configuration>
<scannedDependencies>
<dependency>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-external-jar</artifactId>
</dependency>
</scannedDependencies>
<verbose>false</verbose>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<maven.local.repo>C:\Applications\Atlassian\atlassian-plugin-sdk-6.1.0\repository</maven.local.repo>
<jira.version>7.0.2</jira.version>
<amps.version>6.1.2</amps.version>
<plugin.testrunner.version>1.2.3</plugin.testrunner.version>
<atlassian.spring.scanner.version>1.2.6</atlassian.spring.scanner.version>
<!-- This key is used to keep the consistency between the key in atlassian-plugin.xml and the key to generate bundle. -->
<atlassian.plugin.key>${project.groupId}.${project.artifactId}</atlassian.plugin.key>
<!-- TestKit version 6.x for JIRA 6.x -->
<testkit.version>6.3.11</testkit.version>
</properties>
Sometimes the above error is throwing, and sometimes I am facing jta.jar error even I don't understand why that jar is required. I tried with cloning the repo and starting it, but I'm still facing the same error.
Please add into your project pom.xml, following
<pluginRepositories>
<pluginRepository>
<id>atlassian-public</id>
<url>https://maven.atlassian.com/content/repositories/atlassian-public/</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</snapshots>
<releases>
<enabled>true</enabled>
<checksumPolicy>warn</checksumPolicy>
</releases>
</pluginRepository>
</pluginRepositories>
atlassian-spring-scanner-maven-plugin of course is Maven plugin of Atlassian. It should be hosted in Atlassian Maven Repositories - https://maven.atlassian.com/#nexus-search;quick~atlassian-spring-scanner-maven-plugin. But I see this error message:
Failure to find com.atlassian.plugin:atlassian-spring-scanner-maven-plugin:pom:1.2.6 in http://repo.maven.apache.org/maven2
It says that it can not be looked up in Maven Central Repositories instead of Atlassian Maven Repositories
So I think you should check your Maven runtime settings. Your maven should read local settings.xml from Atlassian plugin SDK which configured Atlassian Maven Proxy, please refer this resource for configuration Atlassian Maven Proxy https://developer.atlassian.com/docs/advanced-topics/working-with-maven/atlassian-maven-repositories
I see your pom.xml has maven.local.repo
<maven.local.repo>C:\Applications\Atlassian\atlassian-plugin-sdk-6.1.0\repository</maven.local.repo>
But it just means that you are using a custom local repository directory, it does not mean your Maven has Atlassian Maven Proxy yet
Can someone answer this question. Is it possible to have the spatial repository in a spring boot app in embedded mode?
#Bean
public GraphDatabaseService graphDatabaseService() {
return new GraphDatabaseFactory().newEmbeddedDatabase("neo4j.db");
}
by just adding the
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-spatial</artifactId>
<version>0.9</version>
</dependency>
to your classpath?
I keep getting the error
Caused by: java.lang.IllegalArgumentException: No index provider 'spatial' found. Maybe the intended provider (or one more of its dependencies) aren't on the classpath or it failed to load.
at org.neo4j.kernel.impl.coreapi.IndexManagerImpl.getIndexProvider(IndexManagerImpl.java:91)
at org.neo4j.kernel.impl.coreapi.IndexManagerImpl.findIndexConfig(IndexManagerImpl.java:142)
at org.neo4j.kernel.impl.coreapi.IndexManagerImpl.getOrCreateIndexConfig(IndexManagerImpl.java:209)
at org.neo4j.kernel.impl.coreapi.IndexManagerImpl.getOrCreateNodeIndex(IndexManagerImpl.java:314)
at org.neo4j.kernel.impl.coreapi.IndexManagerImpl.forNodes(IndexManagerImpl.java:302)
at org.springframework.data.neo4j.support.DelegatingGraphDatabase.createIndex(DelegatingGraphDatabase.java:163)
at org.springframework.data.neo4j.support.index.IndexProviderImpl.createIndex(IndexProviderImpl.java:91)
at org.springframework.data.neo4j.support.index.IndexProviderImpl.getIndex(IndexProviderImpl.java:68)
at org.springframework.data.neo4j.support.index.IndexProviderImpl.getIndex(IndexProviderImpl.java:108)
at org.springframework.data.neo4j.support.mapping.EntityIndexCreator$2.doWithPersistentProperty(EntityIndexCreator.java:61)
at org.springframework.data.neo4j.support.mapping.EntityIndexCreator$2.doWithPersistentProperty(EntityIndexCreator.java:57)
at org.springframework.data.mapping.model.BasicPersistentEntity.doWithProperties(BasicPersistentEntity.java:294)
at org.springframework.data.neo4j.support.mapping.EntityIndexCreator.ensureEntityIndexes(EntityIndexCreator.java:57)
at org.springframework.data.neo4j.support.mapping.Neo4jMappingContext.updateStoredEntityType(Neo4jMappingContext.java:78)
at org.springframework.data.neo4j.support.mapping.Neo4jMappingContext.addPersistentEntity(Neo4jMappingContext.java:71)
at org.springframework.data.neo4j.support.mapping.Neo4jMappingContext.addPersistentEntity(Neo4jMappingContext.java:49)
at org.springframework.data.mapping.context.AbstractMappingContext.addPersistentEntity(AbstractMappingContext.java:257)
at org.springframework.data.mapping.context.AbstractMappingContext.initialize(AbstractMappingContext.java:373)
at org.springframework.data.neo4j.support.mapping.Neo4jMappingContext.initialize(Neo4jMappingContext.java:111)
at org.springframework.data.mapping.context.AbstractMappingContext.afterPropertiesSet(AbstractMappingContext.java:363)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1625)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1562)
... 62 more
Sure, you can have spring data neo4j + spring boot.
You can find the code I wrote here: https://github.com/inserpio/neo4art
And a short post describing how I did it: https://inserpio.wordpress.com/2014/09/21/neo4art-moves-to-cloud-foundry-at-springone-2gx-2014/
Hope it can help!
Cheers,
Lorenzo
Use this repository in your maven pom
<repository>
<id>neo4j-contrib-releases</id>
<url>https://raw.github.com/neo4j-contrib/m2/master/releases</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>neo4j-contrib-snapshots</id>
<url>https://raw.github.com/neo4j-contrib/m2/master/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
with the dependency
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-spatial</artifactId>
<version>0.13-neo4j-2.1.2</version>
</dependency>
Update: Solved! Posted solution as my own answer. Will be accepting it in two days when I'm allowed to.
A little back story
I've been chasing down this rabbit hole for the past few days, and my question has drastically changed shape over that time. Initially, I thought I had an issue with Spring Boot, because it failed to parse one of my #Configuration annotated classes. Debugging that, I determined that Spring was looking in all the right places for one of my JAR-bound dependencies, but was coming up with a FileNotFoundException when trying to load a class from the JAR.
I was thrown off by this, because the JAR in question was quite verifiably on the classpath. I could print out the classpath during app startup, and see my JAR living nice and cozy inside.
So I simplified. And simplified. Eventually, I got things down to a project with two Java source files, and a tiny placeholder JAR pulled through Maven. This JAR only contains one file: tiny/jar/BaseTest.class.
This worked perfectly. From there, I swapped the dependency JAR on this small project. . . and startup failed. So I compared the JARs and noticed something odd.
The realization
While my small JAR contained a folder hierarchy of:
tiny/jar/BaseTest.class
The larger JAR looked like:
WEB-INF/classes/com/company/...
This WEB-INF/classes prefix is the poison which is killing Spring Boot's class loader. It expects to find classes starting from the root: com/company/... -- no prefix allowed.
I believe that Maven's dependency management is doing something tricky here. When my JAR is created using the clean install goal, it has the com/company/... root inside of it. If I manually copy this version of the JAR into my servers WEB-INF/lib folder, everything works, recognizes, and fires up perfectly.
But when Maven is used to bring in the dependency, WEB-INF/classes is prefixed on to my folder hierarchy, breaking everything.
The question
Does anyone know how I can prevent Maven from altering the directory structure of my JAR? The JAR is 100% correct until Maven pulls it in as a dependency, and suddenly the WEB-INF/classes prefix appears.
Here are the three POM files for reference. I've cut out a large swath of dependencies, but left everything else intact for easier reading.
Tiny Jar POM
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>tiny</groupId>
<artifactId>jar</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.1.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<name>jar</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
</dependencies>
</project>
Big Jar POM
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.company</groupId>
<artifactId>company-foundation</artifactId>
<version>0.7.0-SNAPSHOT</version>
<packaging>jar</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.1.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.webflow</groupId>
<artifactId>spring-webflow</artifactId>
<version>2.4.0.RELEASE</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin> <!-- Sonar -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>2.5</version>
</plugin>
</plugins>
</build>
<repositories>
<!-- To use snapshots, you must also use the Sonatype Snapshots respository -->
<repository>
<id>sonatype-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</repository>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</project>
Project POM
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.test</groupId>
<artifactId>dependency-issue</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>jar-dependency-issue</name>
<description>Barebones Spring Boot project used to demonstrate a JAR loading issue.</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.1.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<start-class>demo.JarDependencyIssueApplication</start-class>
<java.version>1.8</java.version>
</properties>
<dependencies>
<!-- To run on a separate server, we need to mark tomcat starter as provided. -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!--
<dependency>
<groupId>com.company</groupId>
<artifactId>company-foundation</artifactId>
<version>0.7.0-SNAPSHOT</version>
</dependency>
-->
<dependency>
<groupId>tiny</groupId>
<artifactId>jar</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
Solved my problem! I just got done poring over the configuring of my projects, comparing them for any suspicious deviations. Turns out that my larger JARs project in Eclipse had its Deployment Assembly (Found under Properties > Deployment Assembly) set to:
Source ============ Deploy Path
src/main/java --------> /WEB-INF/classes
src/main/resources -> /WEB-INF/classes
This caused my server to deploy the JAR into an internal /WEB-INF/classes folder.
Changing the Deploy Path setting to / fixed the problem! Everything is working perfectly now! Woo!
I'm trying to setup Vaadin for a new project.
I'm following the steps documented in https://vaadin.com/wiki/-/wiki/Main/Creating+a+Maven+project
The following command in empty directory:
mvn archetype:generate -DarchetypeGroupId=com.vaadin -DarchetypeArtifactId=vaadin-archetype-application -DarchetypeVersion=7.1.8
Gives me a following error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.2:generate (default-cli) on project standalone-pom: The desired archetype does not exist (com.vaadin:vaadin-archetype-application:7.1.8) -> [Help 1]
I've also tried creating pom with:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>group</groupId>
<artifactId>artifact</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>name</name>
<description>description</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<vaadin.version>7.1.6</vaadin.version>
</properties>
<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-server</artifactId>
<version>${vaadin.version}</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client-compiled</artifactId>
<version>${vaadin.version}</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client</artifactId>
<version>${vaadin.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-themes</artifactId>
<version>${vaadin.version}</version>
</dependency>
</dependencies>
</project>
Running mvm clean install results in the following error:
[ERROR] Failed to execute goal on project artifact: Could not resolve dependencies for project group:artifact:war:1.0-SNAPSHOT: The following artifacts could not be resolved: com.vaadin:vaadin-server:jar:7.1.6, com.vaadin:vaadin-client-compiled:jar:7.1.6, com.vaadin:vaadin-client:jar:7.1.6, com.vaadin:vaadin-themes:jar:7.1.6: Failure to find com.vaadin:vaadin-server:jar:7.1.6 in http://10.255.251.14:9991/nexus/content/groups/public was cached in the local repository, resolution will not be reattempted until the update interval of nexus has elapsed or updates are forced -> [Help 1]
Also there are the following warnings seen:
[WARNING] The POM for com.vaadin:vaadin-server:jar:7.1.6 is missing, no dependency information available
[WARNING] The POM for com.vaadin:vaadin-client-compiled:jar:7.1.6 is missing, no dependency information available
[WARNING] The POM for com.vaadin:vaadin-client:jar:7.1.6 is missing, no dependency information available
[WARNING] The POM for com.vaadin:vaadin-themes:jar:7.1.6 is missing, no dependency information available
At first we thought there might be some problems with our nexus installation, but we also tried running these commands from external machine without nexus. Same issues.
Try to add
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client-compiler</artifactId>
<version>${vaadin.version}</version>
<scope>provided</scope>
</dependency>
Add this to your pom.xml:
<repositories>
<repository>
<id>vaadin-addons</id>
<url>http://maven.vaadin.com/vaadin-addons</url>
</repository>
<repository>
<id>vaadin-snapshots</id>
<url>http://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>vaadin-snapshots</id>
<url>http://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
Then you have to force the update. Example: mvn install -U
It seems that the problem is related to maven repositories and not vaadin.
I've tried locating computer in other country (most likely different maven repository mirror too) and it worked.
Update: I had it working for an hour or so without changing anything and then it started failing again.
This might be related to the heartbleed bug everyone is going crazy about at the moment. Admins probably patching it all over the place and there might be some disruptions to repository services or our own network.
Looks like the list of available archetypes isn't up to date.
Run this command mvn archetype:update-local-catalog