How to use in Eclipse Maven with Log4j2? [duplicate] - java

I'm getting this error trying to use log4j2 with spring boot.
ERROR StatusLogger Log4j2 could not find a logging implementation.
Please add log4j-core to the classpath. Using SimpleLogger to log to the console...
I'm have followed this guide: http://docs.spring.io/spring-boot/docs/current/reference/html/howto-logging.html#howto-configure-log4j-for-logging - and also added the two log4j2-dependencies from https://logging.apache.org/log4j/2.x/maven-artifacts.html
My dependency:tree looks like this:
[INFO] --- maven-dependency-plugin:2.10:tree (default-cli) # musikkjulekalender ---
[INFO] no.saiboten:musikkjulekalender:war:1.0-SNAPSHOT
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:1.4.0.RELEASE:compile
[INFO] | +- org.hibernate:hibernate-validator:jar:5.2.4.Final:compile
[INFO] | | +- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] | | +- org.jboss.logging:jboss-logging:jar:3.3.0.Final:compile
[INFO] | | \- com.fasterxml:classmate:jar:1.3.1:compile
[INFO] | +- org.springframework:spring-web:jar:4.3.2.RELEASE:compile
[INFO] | \- org.springframework:spring-webmvc:jar:4.3.2.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-jetty:jar:1.4.0.RELEASE:compile
[INFO] | +- org.eclipse.jetty:jetty-servlets:jar:9.3.11.v20160721:compile
[INFO] | | +- org.eclipse.jetty:jetty-continuation:jar:9.3.11.v20160721:compile
[INFO] | | +- org.eclipse.jetty:jetty-http:jar:9.3.11.v20160721:compile
[INFO] | | \- org.eclipse.jetty:jetty-io:jar:9.3.11.v20160721:compile
[INFO] | +- org.eclipse.jetty:jetty-webapp:jar:9.3.11.v20160721:compile
[INFO] | | +- org.eclipse.jetty:jetty-xml:jar:9.3.11.v20160721:compile
[INFO] | | \- org.eclipse.jetty:jetty-servlet:jar:9.3.11.v20160721:compile
[INFO] | | \- org.eclipse.jetty:jetty-security:jar:9.3.11.v20160721:compile
[INFO] | +- org.eclipse.jetty.websocket:websocket-server:jar:9.3.11.v20160721:compile
[INFO] | | +- org.eclipse.jetty.websocket:websocket-common:jar:9.3.11.v20160721:compile
[INFO] | | | \- org.eclipse.jetty.websocket:websocket-api:jar:9.3.11.v20160721:compile
[INFO] | | +- org.eclipse.jetty.websocket:websocket-client:jar:9.3.11.v20160721:compile
[INFO] | | \- org.eclipse.jetty.websocket:websocket-servlet:jar:9.3.11.v20160721:compile
[INFO] | \- org.eclipse.jetty.websocket:javax-websocket-server-impl:jar:9.3.11.v20160721:compile
[INFO] | +- org.eclipse.jetty:jetty-annotations:jar:9.3.11.v20160721:compile
[INFO] | | +- org.eclipse.jetty:jetty-plus:jar:9.3.11.v20160721:compile
[INFO] | | +- javax.annotation:javax.annotation-api:jar:1.2:compile
[INFO] | | +- org.ow2.asm:asm:jar:5.0.1:compile
[INFO] | | \- org.ow2.asm:asm-commons:jar:5.0.1:compile
[INFO] | | \- org.ow2.asm:asm-tree:jar:5.0.1:compile
[INFO] | +- org.eclipse.jetty.websocket:javax-websocket-client-impl:jar:9.3.11.v20160721:compile
[INFO] | \- javax.websocket:javax.websocket-api:jar:1.0:compile
[INFO] +- org.springframework.boot:spring-boot-starter-data-jpa:jar:1.4.0.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-aop:jar:1.4.0.RELEASE:compile
[INFO] | | \- org.aspectj:aspectjweaver:jar:1.8.9:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-jdbc:jar:1.4.0.RELEASE:compile
[INFO] | | +- org.apache.tomcat:tomcat-jdbc:jar:8.5.4:compile
[INFO] | | | \- org.apache.tomcat:tomcat-juli:jar:8.5.4:compile
[INFO] | | \- org.springframework:spring-jdbc:jar:4.3.2.RELEASE:compile
[INFO] | +- org.hibernate:hibernate-core:jar:5.0.9.Final:compile
[INFO] | | +- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final:compile
[INFO] | | +- org.javassist:javassist:jar:3.20.0-GA:compile
[INFO] | | +- antlr:antlr:jar:2.7.7:compile
[INFO] | | +- org.jboss:jandex:jar:2.0.0.Final:compile
[INFO] | | +- dom4j:dom4j:jar:1.6.1:compile
[INFO] | | | \- xml-apis:xml-apis:jar:1.4.01:compile
[INFO] | | \- org.hibernate.common:hibernate-commons-annotations:jar:5.0.1.Final:compile
[INFO] | +- org.hibernate:hibernate-entitymanager:jar:5.0.9.Final:compile
[INFO] | +- javax.transaction:javax.transaction-api:jar:1.2:compile
[INFO] | \- org.springframework:spring-aspects:jar:4.3.2.RELEASE:compile
[INFO] +- com.h2database:h2:jar:1.4.192:compile
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:1.4.0.RELEASE:test
[INFO] | +- org.springframework.boot:spring-boot-test:jar:1.4.0.RELEASE:test
[INFO] | +- org.springframework.boot:spring-boot-test-autoconfigure:jar:1.4.0.RELEASE:test
[INFO] | +- com.jayway.jsonpath:json-path:jar:2.2.0:test
[INFO] | | \- net.minidev:json-smart:jar:2.2.1:test
[INFO] | | \- net.minidev:accessors-smart:jar:1.1:test
[INFO] | +- org.assertj:assertj-core:jar:2.5.0:test
[INFO] | +- org.mockito:mockito-core:jar:1.10.19:test
[INFO] | | \- org.objenesis:objenesis:jar:2.1:test
[INFO] | +- org.hamcrest:hamcrest-core:jar:1.3:compile
[INFO] | +- org.hamcrest:hamcrest-library:jar:1.3:test
[INFO] | +- org.skyscreamer:jsonassert:jar:1.3.0:test
[INFO] | | \- org.json:json:jar:20140107:test
[INFO] | +- org.springframework:spring-core:jar:4.3.2.RELEASE:compile
[INFO] | \- org.springframework:spring-test:jar:4.3.2.RELEASE:test
[INFO] +- org.springframework.boot:spring-boot-starter:jar:1.4.0.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot:jar:1.4.0.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-autoconfigure:jar:1.4.0.RELEASE:compile
[INFO] | \- org.yaml:snakeyaml:jar:1.17:runtime
[INFO] +- org.springframework.boot:spring-boot-starter-log4j2:jar:1.4.0.RELEASE:compile
[INFO] | +- org.apache.logging.log4j:log4j-slf4j-impl:jar:2.6.2:compile
[INFO] | +- org.slf4j:jcl-over-slf4j:jar:1.7.21:compile
[INFO] | \- org.slf4j:jul-to-slf4j:jar:1.7.21:compile
[INFO] +- org.apache.logging.log4j:log4j-api:jar:2.6.2:compile
[INFO] +- org.apache.logging.log4j:log4j-core:jar:2.6.2:compile
[INFO] +- org.apache.commons:commons-lang3:jar:3.3.2:compile
[INFO] +- org.mongodb:mongo-java-driver:jar:2.12.4:compile
[INFO] +- org.springframework.data:spring-data-mongodb:jar:1.9.2.RELEASE:compile
[INFO] | +- org.springframework:spring-tx:jar:4.3.2.RELEASE:compile
[INFO] | +- org.springframework:spring-context:jar:4.3.2.RELEASE:compile
[INFO] | +- org.springframework:spring-beans:jar:4.3.2.RELEASE:compile
[INFO] | +- org.springframework:spring-expression:jar:4.3.2.RELEASE:compile
[INFO] | +- org.springframework.data:spring-data-commons:jar:1.12.2.RELEASE:compile
[INFO] | \- org.slf4j:slf4j-api:jar:1.7.21:compile
[INFO] +- com.google.api-client:google-api-client:jar:1.18.0-rc:compile
[INFO] +- com.google.http-client:google-http-client-jackson2:jar:1.18.0-rc:compile
[INFO] | \- com.google.http-client:google-http-client:jar:1.18.0-rc:compile
[INFO] +- com.google.oauth-client:google-oauth-client:jar:1.18.0-rc:compile
[INFO] | \- com.google.code.findbugs:jsr305:jar:1.3.9:compile
[INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.8.2:compile
[INFO] | \- com.fasterxml.jackson.core:jackson-annotations:jar:2.8.1:compile
[INFO] +- com.google.apis:google-api-services-oauth2:jar:v2-rev81-1.19.0:compile
[INFO] +- com.fasterxml.jackson.core:jackson-core:jar:2.8.2:compile
[INFO] +- org.mongodb.morphia:morphia:jar:0.107:compile
[INFO] +- org.springframework.security:spring-security-web:jar:4.1.1.RELEASE:compile
[INFO] | +- aopalliance:aopalliance:jar:1.0:compile
[INFO] | \- org.springframework.security:spring-security-core:jar:4.1.1.RELEASE:compile
[INFO] +- org.springframework.security:spring-security-config:jar:4.1.1.RELEASE:compile
[INFO] | \- org.springframework:spring-aop:jar:4.3.2.RELEASE:compile
[INFO] +- org.springframework.social:spring-social-config:jar:1.1.4.RELEASE:compile
[INFO] | \- org.springframework.social:spring-social-web:jar:1.1.4.RELEASE:compile
[INFO] | \- javax.inject:javax.inject:jar:1:compile
[INFO] +- org.springframework.social:spring-social-core:jar:1.1.4.RELEASE:compile
[INFO] +- org.springframework.social:spring-social-facebook:jar:2.0.3.RELEASE:compile
[INFO] +- org.apache.httpcomponents:httpclient:jar:4.3.6:compile
[INFO] | +- org.apache.httpcomponents:httpcore:jar:4.4.5:compile
[INFO] | \- commons-codec:commons-codec:jar:1.10:compile
[INFO] +- org.mockito:mockito-all:jar:1.10.8:compile
[INFO] +- junit:junit:jar:4.11:compile
[INFO] +- org.eclipse.jetty:apache-jsp:jar:9.3.11.v20160721:provided
[INFO] | +- org.eclipse.jetty:jetty-util:jar:9.3.11.v20160721:compile
[INFO] | +- org.eclipse.jetty:jetty-server:jar:9.3.11.v20160721:compile
[INFO] | +- org.eclipse.jetty.toolchain:jetty-schemas:jar:3.1:provided
[INFO] | +- javax.servlet:javax.servlet-api:jar:3.1.0:compile
[INFO] | +- org.mortbay.jasper:apache-jsp:jar:8.0.33:provided
[INFO] | | \- org.mortbay.jasper:apache-el:jar:8.0.33:provided
[INFO] | \- org.eclipse.jdt.core.compiler:ecj:jar:4.4.2:provided
[INFO] +- javax.servlet:jstl:jar:1.2:compile
[INFO] +- org.springframework.data:spring-data-jpa:jar:1.10.2.RELEASE:compile
[INFO] | +- org.springframework:spring-orm:jar:4.3.2.RELEASE:compile
[INFO] | \- org.aspectj:aspectjrt:jar:1.8.9:compile
[INFO] +- postgresql:postgresql:jar:9.1-901-1.jdbc4:compile
[INFO] \- joda-time:joda-time:jar:2.9.4:compile
I have added the standard log4j2.xml-file to src/main/resources/config with the default config:
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
<Appenders>
<Console name="STDOUT" target="SYSTEM_OUT">
<PatternLayout pattern="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
</Console>
</Appenders>
<Loggers>
<Logger name="org.apache.log4j.xml" level="info"/>
<Root level="debug">
<AppenderRef ref="STDOUT"/>
</Root>
</Loggers>
</Configuration>
Any guesses? I've tried running from within Spring Tool Suite and with the maven spring-boot plugin.
By popular request, here is the complete pom.xml:
<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">
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.0.RELEASE</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>no.saiboten</groupId>
<artifactId>musikkjulekalender</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>Musikkjulekalender</name>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</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</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.3.2</version>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<version>2.12.4</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb</artifactId>
</dependency>
<dependency>
<groupId>com.google.api-client</groupId>
<artifactId>google-api-client</artifactId>
<version>1.18.0-rc</version>
</dependency>
<dependency>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client-jackson2</artifactId>
<version>1.18.0-rc</version>
</dependency>
<dependency>
<groupId>com.google.oauth-client</groupId>
<artifactId>google-oauth-client</artifactId>
<version>1.18.0-rc</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.8.2</version>
</dependency>
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-oauth2</artifactId>
<version>v2-rev81-1.19.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.8.2</version>
</dependency>
<dependency>
<groupId>org.mongodb.morphia</groupId>
<artifactId>morphia</artifactId>
<version>0.107</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.social</groupId>
<artifactId>spring-social-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.social</groupId>
<artifactId>spring-social-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.social</groupId>
<artifactId>spring-social-facebook</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.3.6</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.10.8</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>apache-jsp</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.1-901-1.jdbc4</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.9.4</version>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<useSystemClassLoader>false</useSystemClassLoader>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-releases</id>
<name>Spring Releases</name>
<url>https://repo.spring.io/libs-release</url>
</repository>
<repository>
<id>org.jboss.repository.releases</id>
<name>JBoss Maven Release Repository</name>
<url>https://repository.jboss.org/nexus/content/repositories/releases</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-releases</id>
<name>Spring Releases</name>
<url>https://repo.spring.io/libs-release</url>
</pluginRepository>
</pluginRepositories>
</project>

I looked up the source code of LogManager.class and found the reason was there's no LoggerContextFactory found in log4j-provider.properties which should be found in log4j-core.jar/META-INF.
So check your log4j-core.jar/META-INF/log4j-provider.properties file , or you can delete your log4j-core.jar in your local repository.

It looks your dependencies are correct. This is the pom of working spring-boot application with log4j2 as logging framework:
<!-- Spring logging -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
</dependency>
Put your log4j2.xml into resource folder for running from eclipse; if you prefer to use the different directory - resource/conf - provide the path to log4j2 configuration with JVM argument like this:
-Dlog4j.configurationFile=”conf/log4j2.xml”
Do not give up and switch back from logback to log4j2...

That error message is generated by the log4j-api module when it cannot find or load an implementation of its interfaces. Usually this means that the log4j-core module is missing from the classpath, but looking at your dependency graph that doesn't seem to be the case.
There are some transitive dependencies on the log4j-slf4j-impl and log4j-jul modules but I don't think that could cause the error message.
One way to investigate further is to try starting your application again with this system property set: -Dorg.apache.logging.log4j.simplelog.StatusLogger.level=TRACE. This will print log4j internal debug logging to the console.
(Once your configuration file is loaded the StatusLogger output level can be controlled by setting <Configuration status="trace"> in the beginning of the log4j2.xml configuration file. However, the configuration file is loaded by the log4j-core module, and we're not there yet...)

There might be multiple reasons but common reason is you might have wrong JAR (corrupted).
Delete JARs from repository and try to download again. It will solve the problem.
In my case I have deleted org folder from maven repository
{home}.m2\repository\org.
I have posted similar question here.
Spring boot: ERROR StatusLogger Log4j2 could not find a logging implementation

Adding below setting solved my issue.
-Dlog4j2.loggerContextFactory=org.apache.logging.log4j.core.impl.Log4jContextFactory

Related

SpringBoot Application fails startup when adding dependency

I have an existing SpringBoot Application that was running with no issue. I then created a Java library—a standalone repository with only static Java code, no main class. My library is deployed as a GitHub Maven package.
I then proceeded with setting up my GitHub packages repository in my local Maven settings and added the dependency to my original SpringBoot application. The import process is successful, my library's Jar is in the classpath and compilation and build are successful.
What happens next is I run the application now, and I get the following stacktrace:
02:36:51.110 [main] DEBUG org.springframework.boot.context.logging.ClasspathLoggingApplicationListener - Application failed to start with classpath: [<redacted list of classpath dependencies, including my new library>]
02:36:51.223 [main] ERROR org.springframework.boot.SpringApplication - Application run failed
java.lang.NoSuchMethodError: org.springframework.boot.builder.SpringApplicationBuilder.<init>([Ljava/lang/Object;)V
at org.springframework.cloud.bootstrap.BootstrapApplicationListener.bootstrapServiceContext(BootstrapApplicationListener.java:161)
at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:102)
at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:68)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:127)
at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:80)
at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:53)
at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:345)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:308)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)
at my.org.transfer.TransferServicesApiApplication.main(TransferServicesApiApplication.java:18)
Process finished with exit code 1
I'm not sure what else to try and a night of Googling lead me nowhere.
This is my application's pom.xml:
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.4.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>my.org</groupId>
<artifactId>appname</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency> <!-- my library import -->
<groupId>my.org</groupId>
<artifactId>mylibrary</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</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-web</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.12</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.9.1</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.10.6</version>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>19.0.0</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.7</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.14</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.2</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>5.2.7.RELEASE</version>
</dependency>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-booter</artifactId>
<version>2.22.2</version>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.9.4</version>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>org.influxdb</groupId>
<artifactId>influxdb-java</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<goalPrefix>formatter</goalPrefix>
<executable>true</executable>
</configuration>
</plugin>
<plugin>
<groupId>net.revelc.code.formatter</groupId>
<artifactId>formatter-maven-plugin</artifactId>
<version>2.12.0</version>
</plugin>
</plugins>
</build>
</project>
My library's pom.xml:
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.4.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>my.org</groupId>
<artifactId>mylibrary</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<java.version>1.8</java.version>
</properties>
<distributionManagement>
<repository>
<id>github</id>
<name>Github Packages</name>
<url>https://maven.pkg.github.com/my-org/library-repo</url>
</repository>
</distributionManagement>
<dependencies>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-secretsmanager</artifactId>
<version>1.11.793</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.12</version>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>20.1.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>4.4</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-aws-secrets-manager-config</artifactId>
<version>2.1.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.10</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<version>2.0.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-easymock</artifactId>
<version>2.0.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito2</artifactId>
<version>2.0.7</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>net.revelc.code.formatter</groupId>
<artifactId>formatter-maven-plugin</artifactId>
<version>2.12.0</version>
</plugin>
</plugins>
</build>
</project>
Thanks much.
Edit: set spring-boot-starter-parent version in application pom to match the version in the library pom. No changes.
Edit 2: This is the output of mvn dependency:tree (my library-injected dependency at the bottom):
[INFO] my.org.hopscotchtrading:transfer-services-api:jar:0.0.1-SNAPSHOT
[INFO] +- org.springframework.boot:spring-boot-starter:jar:2.3.4.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot:jar:2.3.4.RELEASE:compile
[INFO] | | \- org.springframework:spring-context:jar:5.2.9.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-autoconfigure:jar:2.3.4.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-logging:jar:2.3.4.RELEASE:compile
[INFO] | | +- ch.qos.logback:logback-classic:jar:1.2.3:compile
[INFO] | | | \- ch.qos.logback:logback-core:jar:1.2.3:compile
[INFO] | | +- org.apache.logging.log4j:log4j-to-slf4j:jar:2.13.3:compile
[INFO] | | | \- org.apache.logging.log4j:log4j-api:jar:2.13.3:compile
[INFO] | | \- org.slf4j:jul-to-slf4j:jar:1.7.30:compile
[INFO] | +- jakarta.annotation:jakarta.annotation-api:jar:1.3.5:compile
[INFO] | +- org.springframework:spring-core:jar:5.2.9.RELEASE:compile
[INFO] | | \- org.springframework:spring-jcl:jar:5.2.9.RELEASE:compile
[INFO] | \- org.yaml:snakeyaml:jar:1.26:compile
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:2.3.4.RELEASE:test
[INFO] | +- org.springframework.boot:spring-boot-test:jar:2.3.4.RELEASE:test
[INFO] | +- org.springframework.boot:spring-boot-test-autoconfigure:jar:2.3.4.RELEASE:test
[INFO] | +- com.jayway.jsonpath:json-path:jar:2.4.0:test
[INFO] | | \- net.minidev:json-smart:jar:2.3:test
[INFO] | | \- net.minidev:accessors-smart:jar:1.2:test
[INFO] | | \- org.ow2.asm:asm:jar:5.0.4:test
[INFO] | +- jakarta.xml.bind:jakarta.xml.bind-api:jar:2.3.3:test
[INFO] | | \- jakarta.activation:jakarta.activation-api:jar:1.2.2:test
[INFO] | +- org.assertj:assertj-core:jar:3.16.1:test
[INFO] | +- org.hamcrest:hamcrest:jar:2.2:test
[INFO] | +- org.junit.jupiter:junit-jupiter:jar:5.6.2:test
[INFO] | | +- org.junit.jupiter:junit-jupiter-api:jar:5.6.2:test
[INFO] | | | +- org.opentest4j:opentest4j:jar:1.2.0:test
[INFO] | | | \- org.junit.platform:junit-platform-commons:jar:1.6.2:test
[INFO] | | +- org.junit.jupiter:junit-jupiter-params:jar:5.6.2:test
[INFO] | | \- org.junit.jupiter:junit-jupiter-engine:jar:5.6.2:test
[INFO] | +- org.junit.vintage:junit-vintage-engine:jar:5.6.2:test
[INFO] | | +- org.apiguardian:apiguardian-api:jar:1.1.0:test
[INFO] | | +- org.junit.platform:junit-platform-engine:jar:1.6.2:test
[INFO] | | \- junit:junit:jar:4.13:test
[INFO] | +- org.mockito:mockito-core:jar:3.3.3:test
[INFO] | | +- net.bytebuddy:byte-buddy:jar:1.10.14:compile
[INFO] | | +- net.bytebuddy:byte-buddy-agent:jar:1.10.14:test
[INFO] | | \- org.objenesis:objenesis:jar:2.6:test
[INFO] | +- org.mockito:mockito-junit-jupiter:jar:3.3.3:test
[INFO] | +- org.skyscreamer:jsonassert:jar:1.5.0:test
[INFO] | | \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test
[INFO] | +- org.springframework:spring-test:jar:5.2.9.RELEASE:test
[INFO] | \- org.xmlunit:xmlunit-core:jar:2.7.0:test
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:2.3.4.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-json:jar:2.3.4.RELEASE:compile
[INFO] | | +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.11.2:compile
[INFO] | | +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.11.2:compile
[INFO] | | \- com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.11.2:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-tomcat:jar:2.3.4.RELEASE:compile
[INFO] | | +- org.apache.tomcat.embed:tomcat-embed-core:jar:9.0.38:compile
[INFO] | | +- org.glassfish:jakarta.el:jar:3.0.3:compile
[INFO] | | \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:9.0.38:compile
[INFO] | \- org.springframework:spring-webmvc:jar:5.2.9.RELEASE:compile
[INFO] | +- org.springframework:spring-aop:jar:5.2.9.RELEASE:compile
[INFO] | \- org.springframework:spring-expression:jar:5.2.9.RELEASE:compile
[INFO] +- org.projectlombok:lombok:jar:1.18.12:compile
[INFO] +- io.jsonwebtoken:jjwt:jar:0.9.1:compile
[INFO] | \- com.fasterxml.jackson.core:jackson-databind:jar:2.11.2:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.11.2:compile
[INFO] | \- com.fasterxml.jackson.core:jackson-core:jar:2.11.2:compile
[INFO] +- joda-time:joda-time:jar:2.10.6:compile
[INFO] +- org.jetbrains:annotations:jar:19.0.0:compile
[INFO] +- commons-io:commons-io:jar:2.7:compile
[INFO] +- commons-codec:commons-codec:jar:1.14:compile
[INFO] +- commons-collections:commons-collections:jar:3.2.2:compile
[INFO] +- commons-lang:commons-lang:jar:2.4:compile
[INFO] +- org.springframework:spring-web:jar:5.2.7.RELEASE:compile
[INFO] | \- org.springframework:spring-beans:jar:5.2.9.RELEASE:compile
[INFO] +- org.apache.maven.surefire:surefire-booter:jar:2.22.2:compile
[INFO] | \- org.apache.maven.surefire:surefire-api:jar:2.22.2:compile
[INFO] | \- org.apache.maven.surefire:surefire-logger-api:jar:2.22.2:compile
[INFO] +- commons-beanutils:commons-beanutils:jar:1.9.4:compile
[INFO] | \- commons-logging:commons-logging:jar:1.2:compile
[INFO] +- javax.validation:validation-api:jar:2.0.1.Final:compile
[INFO] +- io.springfox:springfox-swagger2:jar:2.9.2:compile
[INFO] | +- io.swagger:swagger-annotations:jar:1.5.20:compile
[INFO] | +- io.swagger:swagger-models:jar:1.5.20:compile
[INFO] | +- io.springfox:springfox-spi:jar:2.9.2:compile
[INFO] | | \- io.springfox:springfox-core:jar:2.9.2:compile
[INFO] | +- io.springfox:springfox-schema:jar:2.9.2:compile
[INFO] | +- io.springfox:springfox-swagger-common:jar:2.9.2:compile
[INFO] | +- io.springfox:springfox-spring-web:jar:2.9.2:compile
[INFO] | +- com.google.guava:guava:jar:20.0:compile
[INFO] | +- com.fasterxml:classmate:jar:1.5.1:compile
[INFO] | +- org.slf4j:slf4j-api:jar:1.7.30:compile
[INFO] | +- org.springframework.plugin:spring-plugin-core:jar:1.2.0.RELEASE:compile
[INFO] | +- org.springframework.plugin:spring-plugin-metadata:jar:1.2.0.RELEASE:compile
[INFO] | \- org.mapstruct:mapstruct:jar:1.2.0.Final:compile
[INFO] +- io.springfox:springfox-swagger-ui:jar:2.9.2:compile
[INFO] +- org.influxdb:influxdb-java:jar:2.18:compile
[INFO] | +- com.squareup.retrofit2:retrofit:jar:2.8.1:compile
[INFO] | +- com.squareup.retrofit2:converter-moshi:jar:2.8.1:compile
[INFO] | | \- com.squareup.moshi:moshi:jar:1.8.0:compile
[INFO] | +- org.msgpack:msgpack-core:jar:0.8.20:compile
[INFO] | +- com.squareup.okhttp3:okhttp:jar:3.14.9:compile
[INFO] | | \- com.squareup.okio:okio:jar:1.17.2:compile
[INFO] | \- com.squareup.okhttp3:logging-interceptor:jar:3.14.9:compile
[INFO] \- my.org:mylibrary:jar:0.0.1-SNAPSHOT:compile
[INFO] +- com.amazonaws:aws-java-sdk-secretsmanager:jar:1.11.793:compile
[INFO] | +- com.amazonaws:aws-java-sdk-core:jar:1.11.793:compile
[INFO] | | +- org.apache.httpcomponents:httpclient:jar:4.5.12:compile
[INFO] | | | \- org.apache.httpcomponents:httpcore:jar:4.4.13:compile
[INFO] | | +- software.amazon.ion:ion-java:jar:1.0.2:compile
[INFO] | | \- com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:jar:2.11.2:compile
[INFO] | \- com.amazonaws:jmespath-java:jar:1.11.793:compile
[INFO] +- org.apache.commons:commons-collections4:jar:4.4:compile
[INFO] +- org.springframework.cloud:spring-cloud-aws-secrets-manager-config:jar:2.1.1.RELEASE:compile
[INFO] | \- org.springframework.cloud:spring-cloud-context:jar:1.3.2.RELEASE:compile
[INFO] | \- org.springframework.security:spring-security-crypto:jar:5.3.4.RELEASE:compile
[INFO] \- org.apache.commons:commons-lang3:jar:3.10:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.147 s
[INFO] Finished at: 2020-09-19T13:06:54-05:00
[INFO] ------------------------------------------------------------------------
You're using different versions of spring-boot-starter-parent (2.3.1.RELEASE and 2.3.4.RELEASE) which is probably leading to inconsistent versions where the later or earlier don't have the method. Try using 2.3.4.RELEASE in your application.
[Update]
You're still getting inconsistent versions of org.springframework:* on the classpath:
[INFO] | \- org.springframework:spring-webmvc:jar:5.2.9.RELEASE:compile
[INFO] | +- org.springframework:spring-aop:jar:5.2.9.RELEASE:compile
[INFO] | \- org.springframework:spring-expression:jar:5.2.9.RELEASE:compile
...
[INFO] +- org.springframework:spring-web:jar:5.2.7.RELEASE:compile
In your application pom.xml remove the explicit dependency from
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>5.2.7.RELEASE</version>
</dependency>
and any other dependency that is specified in the parent so you get all 5.2.9 versions in the dependency output.
Finally, there is discussion like here about requiring specific versions for Spring Boot and the latest version of spring-cloud-aws-secrets-manager-config is 2.2.4.RELEASE which makes me think your library's POM needs to be updated to use the latest.

Weird issue running maven site (problems were encountered while processing the POMs)

I'm trying to run mvn site but I keep getting this error message every time. I've tried googling, but have not found any solutions. I'm currently on a Windows machine running maven from git bash.
[WARNING] Unable to create Maven project for org.crashub:crash.shell:pom:1.3.1 from repository.
org.apache.maven.project.InvalidProjectModelException: Some problems were encountered while processing the POMs:
[ERROR] 'dependencies.dependency.systemPath' for com.sun:tools:jar must specify an absolute path but is /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/../Classes/classes.jar # line 98, column 19
My pom-file
<?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.example</groupId>
<artifactId>primecheck</artifactId>
<version>1.0.0-SNAPSHOT</version>
<properties>
<java.version>1.8</java.version>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.3.RELEASE</version>
</parent>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math3</artifactId>
<version>3.4.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.8</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.4</version>
<dependencies>
<dependency>
<groupId>lt.velykis.maven.skins</groupId>
<artifactId>reflow-velocity-tools</artifactId>
<version>1.1.1</version>
</dependency>
<!-- Reflow skin requires Velocity >= 1.7 -->
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
<version>1.7</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-releases</id>
<url>https://repo.spring.io/libs-release</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-releases</id>
<url>https://repo.spring.io/libs-release</url>
</pluginRepository>
<pluginRepository>
<id>central</id>
<name>Maven Plugin Repository</name>
<url>http://repo1.maven.org/maven2</url>
</pluginRepository>
</pluginRepositories>
</project>
Running mvn dependency:tree
[INFO] --- maven-dependency-plugin:2.9:tree (default-cli) # primecheck ---
[INFO] com.tomasruud:primecheck:war:1.0.0-SNAPSHOT
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:1.2.3.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter:jar:1.2.3.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot:jar:1.2.3.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot-autoconfigure:jar:1.2.3.RELEASE:compile
[INFO] | | \- org.yaml:snakeyaml:jar:1.14:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-databind:jar:2.4.5:compile
[INFO] | | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.4.5:compile
[INFO] | | \- com.fasterxml.jackson.core:jackson-core:jar:2.4.5:compile
[INFO] | +- org.hibernate:hibernate-validator:jar:5.1.3.Final:compile
[INFO] | | +- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] | | +- org.jboss.logging:jboss-logging:jar:3.1.3.GA:compile
[INFO] | | \- com.fasterxml:classmate:jar:1.0.0:compile
[INFO] | +- org.springframework:spring-core:jar:4.1.6.RELEASE:compile
[INFO] | +- org.springframework:spring-web:jar:4.1.6.RELEASE:compile
[INFO] | | +- org.springframework:spring-aop:jar:4.1.6.RELEASE:compile
[INFO] | | | \- aopalliance:aopalliance:jar:1.0:compile
[INFO] | | +- org.springframework:spring-beans:jar:4.1.6.RELEASE:compile
[INFO] | | \- org.springframework:spring-context:jar:4.1.6.RELEASE:compile
[INFO] | \- org.springframework:spring-webmvc:jar:4.1.6.RELEASE:compile
[INFO] | \- org.springframework:spring-expression:jar:4.1.6.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-log4j2:jar:1.2.3.RELEASE:compile
[INFO] | +- org.slf4j:jcl-over-slf4j:jar:1.7.11:compile
[INFO] | | \- org.slf4j:slf4j-api:jar:1.7.11:compile
[INFO] | +- org.slf4j:jul-to-slf4j:jar:1.7.11:compile
[INFO] | +- org.apache.logging.log4j:log4j-slf4j-impl:jar:2.1:compile
[INFO] | +- org.apache.logging.log4j:log4j-api:jar:2.1:compile
[INFO] | \- org.apache.logging.log4j:log4j-core:jar:2.1:compile
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:1.2.3.RELEASE:compile
[INFO] | +- junit:junit:jar:4.12:compile
[INFO] | +- org.mockito:mockito-core:jar:1.10.19:compile
[INFO] | | \- org.objenesis:objenesis:jar:2.1:runtime
[INFO] | +- org.hamcrest:hamcrest-core:jar:1.3:compile
[INFO] | +- org.hamcrest:hamcrest-library:jar:1.3:compile
[INFO] | \- org.springframework:spring-test:jar:4.1.6.RELEASE:compile
[INFO] +- org.apache.commons:commons-math3:jar:3.4.1:compile
[INFO] \- org.springframework.boot:spring-boot-starter-tomcat:jar:1.2.3.RELEASE:provided
[INFO] +- org.apache.tomcat.embed:tomcat-embed-core:jar:8.0.20:provided
[INFO] +- org.apache.tomcat.embed:tomcat-embed-el:jar:8.0.20:provided
[INFO] +- org.apache.tomcat.embed:tomcat-embed-logging-juli:jar:8.0.20:provided
[INFO] \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:8.0.20:provided
I have found these 2 related issues:
https://jira.exoplatform.org/browse/CRASH-225
https://jira.codehaus.org/browse/MSHADE-185
So the cause seems to be in the Maven Shade Plugin: the CRaSH POM seems to use the Shade Plugin and then has the wrong, hardcoded systemPath.
According to http://www.crashub.org/:
CRaSH is officially embedded as Spring Boot remote shell.
So org.crashub:crash.shell:pom:1.3.1 seems to be related to Spring Boot, but I don't know what is meant by the warning: "Unable to create Maven project for [...]"
EDIT
Try to add the following dependency to your POM:
<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>1.8</version>
<scope>system</scope>
<systemPath>${java.home}/../lib/tools.jar</systemPath>
<optional>true</optional>
</dependency>

Maven package error: An attached artifact must have a different ID than its corresponding main artifact

Geting this error on: mvn package
It fails to build every time with the same error, I've tried renaming the artifact, as well as changing dependencies for build in the pom file. Please see more details below:
Any help would be very much appreciated.
error:
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.599 s
[INFO] Finished at: 2014-09-29T14:49:45+01:00
[INFO] Final Memory: 33M/379M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.1.7.RELEASE:repackage (default) on project compiled: Execution default of goal org.springframework.boot:spring-boot-maven-plugin:1.1.7.RELEASE:repackage failed: For artifact {com.phil-hudson:compiled:1.0-SNAPSHOT:war}: An attached artifact must have a different ID than its corresponding main artifact. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
Process finished with exit code 1
pom.xml
<?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.phil-hudson</groupId>
<artifactId>compiled</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
<!-- Generic properties -->
<java.version>1.8</java.version>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.1.5.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.3.2</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
</dependency>
<dependency>
<groupId>com.wordnik</groupId>
<artifactId>swagger-jaxrs_2.10</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.13</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.2.8-b01</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.2-promoted-b65</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-servlet-api</artifactId>
<version>8.0.12</version>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>1.1.7.RELEASE</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<warName>disney-product-feed</warName>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-releases</id>
<url>http://repo.spring.io/libs-release</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-releases</id>
<url>http://repo.spring.io/libs-release</url>
</pluginRepository>
</pluginRepositories>
</project>
mvn dependency:tree
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:1.1.5.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter:jar:1.1.5.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot:jar:1.1.5.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot-autoconfigure:jar:1.1.5.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot-starter-logging:jar:1.1.5.RELEASE:compile
[INFO] | | | +- org.slf4j:jcl-over-slf4j:jar:1.7.7:compile
[INFO] | | | +- org.slf4j:jul-to-slf4j:jar:1.7.7:compile
[INFO] | | | +- org.slf4j:log4j-over-slf4j:jar:1.7.7:compile
[INFO] | | | \- ch.qos.logback:logback-classic:jar:1.1.2:compile
[INFO] | | | \- ch.qos.logback:logback-core:jar:1.1.2:compile
[INFO] | | \- org.yaml:snakeyaml:jar:1.13:runtime
[INFO] | +- org.springframework.boot:spring-boot-starter-tomcat:jar:1.1.5.RELEASE:compile
[INFO] | | +- org.apache.tomcat.embed:tomcat-embed-core:jar:7.0.54:compile
[INFO] | | +- org.apache.tomcat.embed:tomcat-embed-el:jar:7.0.54:compile
[INFO] | | \- org.apache.tomcat.embed:tomcat-embed-logging-juli:jar:7.0.54:compile
[INFO] | +- org.hibernate:hibernate-validator:jar:5.0.3.Final:compile
[INFO] | | +- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] | | +- org.jboss.logging:jboss-logging:jar:3.1.1.GA:compile
[INFO] | | \- com.fasterxml:classmate:jar:1.0.0:compile
[INFO] | +- org.springframework:spring-core:jar:4.0.6.RELEASE:compile
[INFO] | \- org.springframework:spring-webmvc:jar:4.0.6.RELEASE:compile
[INFO] | \- org.springframework:spring-expression:jar:4.0.6.RELEASE:compile
[INFO] +- org.springframework:spring-web:jar:4.0.6.RELEASE:compile
[INFO] | +- org.springframework:spring-aop:jar:4.0.6.RELEASE:compile
[INFO] | | \- aopalliance:aopalliance:jar:1.0:compile
[INFO] | +- org.springframework:spring-beans:jar:4.0.6.RELEASE:compile
[INFO] | \- org.springframework:spring-context:jar:4.0.6.RELEASE:compile
[INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.3.3:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.3.3:compile
[INFO] | \- com.fasterxml.jackson.core:jackson-core:jar:2.3.3:compile
[INFO] +- org.apache.commons:commons-lang3:jar:3.3.2:compile
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:1.1.5.RELEASE:compile
[INFO] | +- junit:junit:jar:4.11:compile
[INFO] | +- org.mockito:mockito-core:jar:1.9.5:compile
[INFO] | | \- org.objenesis:objenesis:jar:1.0:compile
[INFO] | +- org.hamcrest:hamcrest-core:jar:1.3:compile
[INFO] | +- org.hamcrest:hamcrest-library:jar:1.3:compile
[INFO] | \- org.springframework:spring-test:jar:4.0.6.RELEASE:compile
[INFO] +- javax.inject:javax.inject:jar:1:compile
[INFO] +- com.wordnik:swagger-jaxrs_2.10:jar:1.3.2:compile
[INFO] | +- org.scala-lang:scala-library:jar:2.10.0:compile
[INFO] | +- com.wordnik:swagger-core_2.10:jar:1.3.2:compile
[INFO] | | +- commons-lang:commons-lang:jar:2.4:compile
[INFO] | | +- org.slf4j:slf4j-api:jar:1.7.7:compile
[INFO] | | +- com.fasterxml.jackson.module:jackson-module-scala_2.10:jar:2.1.5:compile
[INFO] | | | +- com.thoughtworks.paranamer:paranamer:jar:2.3:compile
[INFO] | | | \- org.scala-lang:scala-reflect:jar:2.10.0:compile
[INFO] | | +- com.fasterxml.jackson.module:jackson-module-jsonSchema:jar:2.1.0:compile
[INFO] | | +- com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:jar:2.0.0:compile
[INFO] | | | \- com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.0.0:compile
[INFO] | | +- com.wordnik:swagger-annotations:jar:1.3.2:compile
[INFO] | | +- org.json4s:json4s-ext_2.10:jar:3.2.4:compile
[INFO] | | | +- joda-time:joda-time:jar:2.3:compile
[INFO] | | | \- org.joda:joda-convert:jar:1.2:compile
[INFO] | | +- org.json4s:json4s-native_2.10:jar:3.2.4:compile
[INFO] | | | \- org.json4s:json4s-core_2.10:jar:3.2.4:compile
[INFO] | | | +- org.json4s:json4s-ast_2.10:jar:3.2.4:compile
[INFO] | | | \- org.scala-lang:scalap:jar:2.10.0:compile
[INFO] | | | \- org.scala-lang:scala-compiler:jar:2.10.0:compile
[INFO] | | \- org.json4s:json4s-jackson_2.10:jar:3.2.4:compile
[INFO] | +- javax.ws.rs:jsr311-api:jar:1.1.1:compile
[INFO] | \- org.reflections:reflections:jar:0.9.8:compile
[INFO] | +- com.google.guava:guava:jar:11.0.2:compile
[INFO] | | \- com.google.code.findbugs:jsr305:jar:1.3.9:compile
[INFO] | +- javassist:javassist:jar:3.12.1.GA:compile
[INFO] | \- dom4j:dom4j:jar:1.6.1:compile
[INFO] | \- xml-apis:xml-apis:jar:1.0.b2:compile
[INFO] +- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.13:compile
[INFO] | \- org.codehaus.jackson:jackson-core-asl:jar:1.9.13:compile
[INFO] +- com.sun.xml.bind:jaxb-core:jar:2.2.8-b01:compile
[INFO] | +- javax.xml.bind:jaxb-api:jar:2.2.9:compile
[INFO] | \- com.sun.istack:istack-commons-runtime:jar:2.16:compile
[INFO] +- com.sun.xml.bind:jaxb-impl:jar:2.2-promoted-b65:compile
[INFO] +- org.apache.tomcat:tomcat-servlet-api:jar:8.0.12:compile
[INFO] \- javax.servlet.jsp:jsp-api:jar:2.1:provided
As Dimitri suggested, I solved this by adding classifier to spring-boot-maven-plugin:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<classifier>boot</classifier>
</configuration>
</plugin>
Looks like a bug in spring-boot-maven-plugin together with your version of Maven.
As far as I can tell, Maven knows that the WAR plugin will generate the file target/compiled-1.0-SNAPSHOT.war. when it asks the spring-boot-maven-plugin for its output, it will get the same name. Since Maven doesn't know what the plugin does, it will assume that both are configured to create the same output file and stop since that can't be what you want (the files will overwrite each other).
Try with the latest version of Maven or file a bug against the spring-boot-maven-plugin. Let them know which version of Maven you're using.
I am currently facing the same issue.
However, providing the required parameter finalName, I can see that the .war file is well boot-ified.
Please note that I still encounter the error message in both cases (with and without the finalName).
Here is the link to the issue I opened on the Spring Boot project: https://github.com/spring-projects/spring-boot/issues/2060
All that is required is to include a <finalName> tag in the build section.
<build>
<finalName>myJar</finalName>
</build>

Spring Bean ClassNotFound how to debug?

I'm new to Spring and im getting the following error
java.lang.NoClassDefFoundError: org/springframework/beans/factory/NoUniqueBeanDefinitionException
java.lang.Class.getDeclaredMethods0(Native Method)
java.lang.Class.privateGetDeclaredMethods(Class.java:2531)
java.lang.Class.getDeclaredMethods(Class.java:1855)
org.springframework.core.type.StandardAnnotationMetadata.hasAnnotatedMethods(StandardAnnotationMetadata.java:159)
org.springframework.context.annotation.ConfigurationClassUtils.isLiteConfigurationCandidate(ConfigurationClassUtils.java:104)
org.springframework.context.annotation.ConfigurationClassUtils.checkConfigurationClassCandidate(ConfigurationClassUtils.java:87)
org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:253)
org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:223)
org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:630)
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:461)
org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:647)
org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:598)
org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:661)
org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:517)
org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:458)
org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:138)
javax.servlet.GenericServlet.init(GenericServlet.java:160)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:409)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1044)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
org.apache.tomcat.util.net.AprEndpoint$SocketWithOptionsProcessor.run(AprEndpoint.java:2378)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
java.lang.Thread.run(Thread.java:744)
From what I've searched it seems that I'm missing a library, so here is my POM
<properties>
<spring.version>3.2.0.RELEASE</spring.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
<!--Jersey-->
<dependency>
<groupId>org.glassfish.jersey.ext</groupId>
<artifactId>jersey-spring3</artifactId>
<version>2.5.1</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-xml-provider</artifactId>
<version>2.3.0</version>
</dependency>
<!--Security-->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>3.2.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>3.2.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>3.2.0.RELEASE</version>
</dependency>
<!--Spring Data JDBC-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>4.0.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>4.0.0.RELEASE</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.28</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.3.0.Final</version>
</dependency>
If you guys could help me figure out which Lib it it i would be grateful.
But can some one teach how to debug this kind of error?
I'm using Intelij Idea 13
Here is the output of mvn dependency:three
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) # WebGest ---
[INFO] com.springapp:WebGest:war:1.0-SNAPSHOT
[INFO] +- org.springframework:spring-core:jar:3.2.0.RELEASE:compile
[INFO] | \- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] +- org.springframework:spring-web:jar:3.2.0.RELEASE:compile
[INFO] | +- org.springframework:spring-context:jar:3.2.0.RELEASE:compile
[INFO] | +- org.springframework:spring-aop:jar:3.2.0.RELEASE:compile
[INFO] | \- aopalliance:aopalliance:jar:1.0:compile
[INFO] +- org.springframework:spring-beans:jar:3.2.0.RELEASE:compile
[INFO] +- javax.servlet:servlet-api:jar:2.5:compile
[INFO] +- javax.servlet.jsp:jsp-api:jar:2.1:provided
[INFO] +- org.springframework:spring-webmvc:jar:3.2.0.RELEASE:compile
[INFO] | \- org.springframework:spring-expression:jar:3.2.0.RELEASE:compile
[INFO] +- org.springframework:spring-test:jar:3.2.0.RELEASE:test
[INFO] +- junit:junit:jar:4.8.2:test
[INFO] +- org.glassfish.jersey.ext:jersey-spring3:jar:2.5.1:compile
[INFO] | +- org.glassfish.jersey.core:jersey-server:jar:2.5.1:compile
[INFO] | | +- org.glassfish.jersey.core:jersey-common:jar:2.5.1:compile
[INFO] | | | +- javax.annotation:javax.annotation-api:jar:1.2:compile
[INFO] | | | \- org.glassfish.hk2:osgi-resource-locator:jar:1.0.1:compile
[INFO] | | +- org.glassfish.jersey.core:jersey-client:jar:2.5.1:compile
[INFO] | | +- com.google.guava:guava:jar:14.0.1:compile
[INFO] | | +- org.glassfish.hk2:hk2-api:jar:2.2.0-b21:compile
[INFO] | | +- org.glassfish.hk2.external:javax.inject:jar:2.2.0-b21:compile
[INFO] | | +- org.glassfish.hk2:hk2-locator:jar:2.2.0-b21:compile
[INFO] | | | +- org.glassfish.hk2.external:asm-all-repackaged:jar:2.2.0-b21:compile
[INFO] | | | \- org.glassfish.hk2.external:cglib:jar:2.2.0-b21:compile
[INFO] | | \- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] | +- org.glassfish.jersey.containers:jersey-container-servlet-core:jar:2.5.1:compile
[INFO] | +- org.glassfish.hk2:hk2:jar:2.2.0-b21:compile
[INFO] | | +- org.glassfish.hk2:hk2-utils:jar:2.2.0-b21:compile
[INFO] | | | \- javax.inject:javax.inject:jar:1:compile
[INFO] | | +- org.glassfish.hk2:config-types:jar:2.2.0-b21:compile
[INFO] | | +- org.glassfish.hk2:core:jar:2.2.0-b21:compile
[INFO] | | +- org.glassfish.hk2:hk2-config:jar:2.2.0-b21:compile
[INFO] | | | +- org.jvnet:tiger-types:jar:1.4:compile
[INFO] | | | \- org.glassfish.hk2.external:bean-validator:jar:2.2.0-b21:compile
[INFO] | | +- org.glassfish.hk2:hk2-runlevel:jar:2.2.0-b21:compile
[INFO] | | \- org.glassfish.hk2:class-model:jar:2.2.0-b21:compile
[INFO] | +- org.glassfish.hk2:spring-bridge:jar:2.2.0-b21:compile
[INFO] | \- javax.ws.rs:javax.ws.rs-api:jar:2.0:compile
[INFO] +- com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:jar:2.3.0:compile
[INFO] | +- com.fasterxml.jackson.jaxrs:jackson-jaxrs-base:jar:2.3.0:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-core:jar:2.3.0:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-databind:jar:2.3.0:compile
[INFO] | | \- com.fasterxml.jackson.core:jackson-annotations:jar:2.3.0:compile
[INFO] | \- com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.3.0:compile
[INFO] +- com.fasterxml.jackson.jaxrs:jackson-jaxrs-xml-provider:jar:2.3.0:compile
[INFO] | +- com.fasterxml.jackson.dataformat:jackson-dataformat-xml:jar:2.3.0:compile
[INFO] | +- org.codehaus.woodstox:stax2-api:jar:3.1.1:compile
[INFO] | | \- javax.xml.stream:stax-api:jar:1.0-2:compile
[INFO] | \- org.codehaus.woodstox:woodstox-core-asl:jar:4.1.4:compile
[INFO] +- org.springframework.security:spring-security-web:jar:3.2.0.RELEASE:compile
[INFO] | \- org.springframework.security:spring-security-core:jar:3.2.0.RELEASE:compile
[INFO] +- org.springframework.security:spring-security-config:jar:3.2.0.RELEASE:compile
[INFO] +- org.springframework:spring-jdbc:jar:4.0.0.RELEASE:compile
[INFO] | \- org.springframework:spring-tx:jar:4.0.0.RELEASE:compile
[INFO] +- org.springframework:spring-orm:jar:4.0.0.RELEASE:compile
[INFO] +- mysql:mysql-connector-java:jar:5.1.28:compile
[INFO] \- org.hibernate:hibernate-core:jar:4.3.0.Final:compile
[INFO] +- org.jboss.logging:jboss-logging:jar:3.1.3.GA:compile
[INFO] +- org.jboss.logging:jboss-logging-annotations:jar:1.2.0.Beta1:compile
[INFO] +- org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:jar:1.0.0.Final:compile
[INFO] +- dom4j:dom4j:jar:1.6.1:compile
[INFO] | \- xml-apis:xml-apis:jar:1.0.b2:compile
[INFO] +- org.hibernate.common:hibernate-commons-annotations:jar:4.0.4.Final:compile
[INFO] +- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final:compile
[INFO] +- org.javassist:javassist:jar:3.18.1-GA:compile
[INFO] +- antlr:antlr:jar:2.7.7:compile
[INFO] \- org.jboss:jandex:jar:1.1.0.Final:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.348s
[INFO] Finished at: Mon Feb 03 21:43:43 WET 2014
[INFO] Final Memory: 13M/217M
[INFO] ------------------------------------------------------------------------
To troubleshoot these kind of problems, search for the class in either findjar.com or
grepcode.com, in this case this is the report from grepcode for NoUniqueBeanDefinitionException.
There we can see that that class is not on version 3.2.0 of the spring-beans jar, and that the earliest version that has it 3.2.1.RELEASE.
Then check the version used in your project with mvn dependency:tree, and adapt accordingly, in this case upgrade to at least 3.2.1.RELEASE.
This class seems (from a since tag) to be introduced in Spring 3.2.1. Try to change spring.version to 3.2.1.RELEASE (to upgrade also spring-beans.jar which holds this class).

Why servlet-api.jar turns its status from test to compile?

This is what I have in pom.xml:
<dependency>
<groupId>com.sun.jersey.jersey-test-framework</groupId>
<artifactId>jersey-test-framework-grizzly</artifactId>
<version>1.4</version>
<scope>test</scope>
</dependency>
This is what I see after mvn --debug war:war:
[...]
[DEBUG] com.sun.jersey.jersey-test-framework:jersey-test-framework-grizzly:jar:1.4:test
[DEBUG] com.sun.jersey.jersey-test-framework:jersey-test-framework-core:jar:1.4:test
[DEBUG] org.glassfish:javax.servlet:jar:3.0-b66:test
[DEBUG] com.sun.grizzly:grizzly-servlet-webserver:jar:1.9.18-i:test
[DEBUG] com.sun.grizzly:grizzly-http:jar:1.9.18-i:test
[DEBUG] com.sun.grizzly:grizzly-framework:jar:1.9.18-i:test
[DEBUG] com.sun.grizzly:grizzly-rcm:jar:1.9.18-i:test
[DEBUG] com.sun.grizzly:grizzly-portunif:jar:1.9.18-i:test
[DEBUG] com.sun.grizzly:grizzly-http-servlet:jar:1.9.18-i:test
[DEBUG] com.sun.grizzly:grizzly-utils:jar:1.9.18-i:test
[DEBUG] javax.servlet:servlet-api:jar:2.5:compile
[...]
Pay attention to the last line. Why it's not "test", but "compile"?
ps. Indeed it's very weird. This is my complete pom.xml (sorry, it's not short):
[...]
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version> <!-- 10 Sep 2010 -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>xom</groupId>
<artifactId>xom</artifactId>
<version>1.2.5</version> <!-- 13 Oct 2010 -->
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.8.5</version> <!-- 9 Oct 2010 -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-io</artifactId>
<version>1.3.2</version> <!-- 9 Oct 2010 -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>1.6.2</version> <!-- 12 Oct 2010 -->
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version> <!-- 2 Nov 2010 -->
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<!-- version see below in dependencyManagement section -->
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-client</artifactId>
<!-- version see below in dependencyManagement section -->
</dependency>
<dependency>
<groupId>com.sun.jersey.jersey-test-framework</groupId>
<artifactId>jersey-test-framework-grizzly</artifactId>
<!-- version see below in dependencyManagement section -->
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<!-- version see below in dependencyManagement section -->
</dependency>
<dependency>
<groupId>org.apache.openejb</groupId>
<artifactId>openejb-ejbd</artifactId>
<!-- version see below in dependencyManagement section -->
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<!-- version see below in dependencyManagement section -->
</dependency>
<dependency>
<groupId>hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<!-- version see below in dependencyManagement section -->
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>6.0</version> <!-- 9 Oct 2010 -->
<scope>provided</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-core</artifactId>
<version>${jersey.version}</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>${jersey.version}</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-client</artifactId>
<version>${jersey.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sun.jersey.jersey-test-framework</groupId>
<artifactId>jersey-test-framework-grizzly</artifactId>
<version>${jersey.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>${hibernate.version}</version>
</dependency>
<dependency>
<groupId>org.apache.openejb</groupId>
<artifactId>openejb-ejbd</artifactId>
<version>3.1.3</version> <!-- 26 October 2010 -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<version>1.4.2</version> <!-- 29 oct 2010 -->
</dependency>
<dependency>
<groupId>hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>1.8.0.10</version> <!-- 12 October 2010 -->
<scope>test</scope>
</dependency>
</dependencies>
</dependencyManagement>
[...]
This is how maven-war-plugin is configured:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.0</version>
<configuration>
<archive>
<manifestEntries>
<SCM-Revision>${buildNumber}</SCM-Revision>
</manifestEntries>
</archive>
</configuration>
</plugin>
This is very very weird, I don't get the same output when running mvn with --debug:
$ mvn --debug compile
...
[DEBUG] com.sun.jersey.jersey-test-framework:jersey-test-framework-grizzly:jar:1.4:test
[DEBUG] com.sun.jersey.jersey-test-framework:jersey-test-framework-core:jar:1.4:test
[DEBUG] com.sun.jersey:jersey-server:jar:1.4:test
[DEBUG] com.sun.jersey:jersey-core:jar:1.4:test
[DEBUG] asm:asm:jar:3.1:test
[DEBUG] com.sun.jersey:jersey-client:jar:1.4:test
[DEBUG] org.glassfish:javax.servlet:jar:3.0-b66:test
[DEBUG] com.sun.grizzly:grizzly-servlet-webserver:jar:1.9.18-i:test
[DEBUG] com.sun.grizzly:grizzly-http:jar:1.9.18-i:test
[DEBUG] com.sun.grizzly:grizzly-framework:jar:1.9.18-i:test
[DEBUG] com.sun.grizzly:grizzly-rcm:jar:1.9.18-i:test
[DEBUG] com.sun.grizzly:grizzly-portunif:jar:1.9.18-i:test
[DEBUG] com.sun.grizzly:grizzly-http-servlet:jar:1.9.18-i:test
[DEBUG] com.sun.grizzly:grizzly-utils:jar:1.9.18-i:test
[DEBUG] javax.servlet:servlet-api:jar:2.5:test
...
Which is coherent with the dependency:tree:
$ mvn dependency:tree
[INFO] Scanning for projects...
...
[INFO] \- com.sun.jersey.jersey-test-framework:jersey-test-framework-grizzly:jar:1.4:test
[INFO] +- com.sun.jersey.jersey-test-framework:jersey-test-framework-core:jar:1.4:test
[INFO] | +- com.sun.jersey:jersey-server:jar:1.4:test
[INFO] | | +- com.sun.jersey:jersey-core:jar:1.4:test
[INFO] | | \- asm:asm:jar:3.1:test
[INFO] | +- com.sun.jersey:jersey-client:jar:1.4:test
[INFO] | \- org.glassfish:javax.servlet:jar:3.0-b66:test
[INFO] \- com.sun.grizzly:grizzly-servlet-webserver:jar:1.9.18-i:test
[INFO] +- com.sun.grizzly:grizzly-http:jar:1.9.18-i:test
[INFO] | +- com.sun.grizzly:grizzly-framework:jar:1.9.18-i:test
[INFO] | +- com.sun.grizzly:grizzly-rcm:jar:1.9.18-i:test
[INFO] | \- com.sun.grizzly:grizzly-portunif:jar:1.9.18-i:test
[INFO] +- com.sun.grizzly:grizzly-http-servlet:jar:1.9.18-i:test
[INFO] | \- com.sun.grizzly:grizzly-utils:jar:1.9.18-i:test
[INFO] \- javax.servlet:servlet-api:jar:2.5:test
...
The servlet-api artifact has a test scope as expected.
Do you have the servlet-api declared as dependency with a compile scope somewhere? That's the only way I could reproduce.
Update: I reproduced the output with mvn --debug after pasting all dependencies your provided. That said, I don't know how to interpret this output which is printed when the maven-compiler-plugin is executed. Also note that it differs from the dependency:tree:
$ mvn dependency:tree
[INFO] Scanning for projects...
...
[INFO] --- maven-dependency-plugin:2.1:tree (default-cli) # Q4098082 ---
[INFO] com.stackoverflow:Q4098082:jar:1.0-SNAPSHOT
[INFO] +- junit:junit:jar:4.7:test
[INFO] +- xom:xom:jar:1.2.5:compile
[INFO] | +- xml-apis:xml-apis:jar:1.3.03:compile
[INFO] | +- xerces:xercesImpl:jar:2.8.0:compile
[INFO] | \- xalan:xalan:jar:2.7.0:compile
[INFO] +- org.mockito:mockito-all:jar:1.8.5:test
[INFO] +- org.apache.commons:commons-io:jar:1.3.2:test
[INFO] +- joda-time:joda-time:jar:1.6.2:compile
[INFO] +- commons-httpclient:commons-httpclient:jar:3.1:compile
[INFO] | +- commons-logging:commons-logging:jar:1.0.4:compile
[INFO] | \- commons-codec:commons-codec:jar:1.2:compile
[INFO] +- com.sun.jersey:jersey-server:jar:1.4:compile
[INFO] | +- com.sun.jersey:jersey-core:jar:1.4:compile
[INFO] | \- asm:asm:jar:3.1:compile
[INFO] +- com.sun.jersey:jersey-client:jar:1.4:test
[INFO] +- com.sun.jersey.jersey-test-framework:jersey-test-framework-grizzly:jar:1.4:test
[INFO] | +- com.sun.jersey.jersey-test-framework:jersey-test-framework-core:jar:1.4:test
[INFO] | | \- org.glassfish:javax.servlet:jar:3.0-b66:test
[INFO] | \- com.sun.grizzly:grizzly-servlet-webserver:jar:1.9.18-i:test
[INFO] | +- com.sun.grizzly:grizzly-http:jar:1.9.18-i:test
[INFO] | | +- com.sun.grizzly:grizzly-framework:jar:1.9.18-i:test
[INFO] | | +- com.sun.grizzly:grizzly-rcm:jar:1.9.18-i:test
[INFO] | | \- com.sun.grizzly:grizzly-portunif:jar:1.9.18-i:test
[INFO] | +- com.sun.grizzly:grizzly-http-servlet:jar:1.9.18-i:test
[INFO] | | \- com.sun.grizzly:grizzly-utils:jar:1.9.18-i:test
[INFO] | \- javax.servlet:servlet-api:jar:2.5:test
[INFO] +- org.hibernate:hibernate-entitymanager:jar:3.5.6-Final:compile
[INFO] | +- org.hibernate:hibernate-core:jar:3.5.6-Final:compile
[INFO] | | +- antlr:antlr:jar:2.7.6:compile
[INFO] | | +- commons-collections:commons-collections:jar:3.1:compile
[INFO] | | +- dom4j:dom4j:jar:1.6.1:compile
[INFO] | | \- javax.transaction:jta:jar:1.1:compile
[INFO] | +- org.hibernate:hibernate-annotations:jar:3.5.6-Final:compile
[INFO] | | \- org.hibernate:hibernate-commons-annotations:jar:3.2.0.Final:compile
[INFO] | +- cglib:cglib:jar:2.2:compile
[INFO] | +- javassist:javassist:jar:3.9.0.GA:compile
[INFO] | +- org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.0.Final:compile
[INFO] | \- org.slf4j:slf4j-api:jar:1.5.8:compile
[INFO] +- org.apache.openejb:openejb-ejbd:jar:3.1.3:test
[INFO] | +- org.apache.openejb:javaee-api:jar:5.0-3:test
[INFO] | +- org.apache.openejb:openejb-core:jar:3.1.3:test
[INFO] | | +- log4j:log4j:jar:1.2.12:test
[INFO] | | +- org.apache.openejb:ejb31-api-experimental:jar:3.1.3:test
[INFO] | | +- org.apache.openejb:openejb-api:jar:3.1.3:test
[INFO] | | +- org.apache.openejb:openejb-javaagent:jar:3.1.3:test
[INFO] | | +- org.apache.openejb:openejb-jee:jar:3.1.3:test
[INFO] | | | +- org.codehaus.woodstox:wstx-asl:jar:3.2.0:test
[INFO] | | | | \- stax:stax-api:jar:1.0.1:test
[INFO] | | | \- com.sun.xml.bind:jaxb-impl:jar:2.1.9:test
[INFO] | | +- commons-cli:commons-cli:jar:1.1:test
[INFO] | | +- org.apache.activemq:activemq-ra:jar:5.3.1:test
[INFO] | | +- org.apache.activemq:activemq-core:jar:5.3.1:test
[INFO] | | | +- commons-logging:commons-logging-api:jar:1.1:test
[INFO] | | | +- org.apache.geronimo.specs:geronimo-jms_1.1_spec:jar:1.1.1:test
[INFO] | | | +- org.apache.activemq:activeio-core:jar:3.1.2:test
[INFO] | | | | \- org.apache.geronimo.specs:geronimo-j2ee-management_1.1_spec:jar:1.0.1:test
[INFO] | | | +- org.apache.activemq:kahadb:jar:5.3.1:test
[INFO] | | | +- org.apache.activemq.protobuf:activemq-protobuf:jar:1.0:test
[INFO] | | | +- org.apache.geronimo.specs:geronimo-j2ee-management_1.0_spec:jar:1.0:test
[INFO] | | | \- commons-net:commons-net:jar:2.0:test
[INFO] | | +- org.apache.openjpa:openjpa:jar:1.2.1:test
[INFO] | | | +- net.sourceforge.serp:serp:jar:1.13.1:test
[INFO] | | | +- commons-lang:commons-lang:jar:2.1:test
[INFO] | | | \- commons-pool:commons-pool:jar:1.3:test
[INFO] | | +- org.apache.geronimo.components:geronimo-connector:jar:2.1:test
[INFO] | | +- org.apache.geronimo.components:geronimo-transaction:jar:2.1:test
[INFO] | | +- org.objectweb.howl:howl:jar:1.0.1-1:test
[INFO] | | +- org.apache.geronimo.javamail:geronimo-javamail_1.4_mail:jar:1.2:test
[INFO] | | +- org.apache.xbean:xbean-asm-shaded:jar:3.7:test
[INFO] | | +- org.apache.xbean:xbean-finder-shaded:jar:3.7:test
[INFO] | | +- org.apache.xbean:xbean-reflect:jar:3.7:test
[INFO] | | +- org.apache.xbean:xbean-naming:jar:3.7:test
[INFO] | | +- org.apache.openejb:commons-dbcp-all:jar:1.3-r699049:test
[INFO] | | +- org.codehaus.swizzle:swizzle-stream:jar:1.0.1:test
[INFO] | | +- wsdl4j:wsdl4j:jar:1.6.1:test
[INFO] | | \- quartz:quartz:jar:1.5.2:test
[INFO] | +- org.apache.openejb:openejb-server:jar:3.1.3:test
[INFO] | +- org.apache.openejb:openejb-loader:jar:3.1.3:test
[INFO] | \- org.apache.openejb:openejb-client:jar:3.1.3:test
[INFO] +- org.slf4j:slf4j-jdk14:jar:1.4.2:compile
[INFO] +- hsqldb:hsqldb:jar:1.8.0.10:test
[INFO] \- javax:javaee-api:jar:6.0:provided
...
The above is my reference to analyze the scope of dependencies and it looks correct. I don't know why the maven-compiler-plugin outputs a different result in debug mode, I don't know if this is expected, I never pay attention to the output.
Additional remark, the javax.servlet:servlet-api:jar:2.5 is on the (huge) test classpath during the compiler:testCompile execution.
So while I don't have a full explanation, I can't spot any side effect.
This is what I've done to solve the problem:
[...]
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jsp-api</artifactId>
<version>2.0</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
</exclusions>
</dependency>
[...]

Categories