Kevin Kevin - 4 months ago 15
Java Question

java dependencies error with maven and spring

I am getting an error when i tried to use both mavencli and spring in my maven dependencies.

mavencli won't clean and install properly when spring boot is being use.

Here is my maven pom.xml

<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.5.RELEASE</version>
</parent>
<artifactId>maven-client</artifactId>
<groupId>com.group</groupId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<dependencies>
<!-- MAVEN CLI depenedencies -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.5</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-embedder</artifactId>
<version>3.3.3</version>
</dependency>
<dependency>
<groupId>org.eclipse.aether</groupId>
<artifactId>aether-connector-basic</artifactId>
<version>1.0.2.v20150114</version>
</dependency>
<dependency>
<groupId>org.eclipse.aether</groupId>
<artifactId>aether-transport-wagon</artifactId>
<version>1.0.2.v20150114</version>
</dependency>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-http</artifactId>
<version>2.9</version>
</dependency>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-provider-api</artifactId>
<version>2.9</version>
</dependency>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-http-lightweight</artifactId>
<version>2.9</version>
</dependency>
<!-- SPRING BOOT STARTER -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>


and here is my stack error

10:00:52.395 [main] DEBUG org.apache.maven.plugin.checkstyle.resource.LicenseResourceManager - The resource 'LICENSE.txt' was not found with resourceLoader org.codehaus.plexus.resource.loader.URLResourceLoader.
10:00:52.395 [main] DEBUG org.apache.maven.plugin.checkstyle.exec.DefaultCheckstyleExecutor - Unable to process header location: LICENSE.txt
10:00:52.395 [main] DEBUG org.apache.maven.plugin.checkstyle.exec.DefaultCheckstyleExecutor - Checkstyle will throw exception if ${checkstyle.header.file} is used
10:00:52.580 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------
10:00:52.580 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Reactor Summary:
10:00:52.580 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger -
10:00:52.580 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Test Connector with Adapter ........................ FAILURE [ 5.694 s]
10:00:52.581 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Test Connector ..................................... SKIPPED
10:00:52.581 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Test Connector ..................................... SKIPPED
10:00:52.581 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------
10:00:52.581 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - BUILD FAILURE
10:00:52.581 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------
10:00:52.581 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Total time: 5.831 s
10:00:52.581 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Finished at: 2016-07-15T10:00:52+08:00
10:00:52.757 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Final Memory: 20M/303M
10:00:52.758 [main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------
10:00:52.764 [main] ERROR org.apache.maven.cli.MavenCli - Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:2.15:check (validate) on project project-test-connector-adapter: Execution validate of goal org.apache.maven.plugins:maven-checkstyle-plugin:2.15:check failed: An API incompatibility was encountered while executing org.apache.maven.plugins:maven-checkstyle-plugin:2.15:check: java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;Ljava/lang/Throwable;)V
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - -----------------------------------------------------
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - realm = plugin>org.apache.maven.plugins:maven-checkstyle-plugin:2.15
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[0] = file:/Users/me/.m2/repository/org/apache/maven/plugins/maven-checkstyle-plugin/2.15/maven-checkstyle-plugin-2.15.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[1] = file:/Users/me/.m2/repository/com/puppycrawl/tools/checkstyle/6.18/checkstyle-6.18.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[2] = file:/Users/me/.m2/repository/antlr/antlr/2.7.7/antlr-2.7.7.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[3] = file:/Users/me/.m2/repository/org/antlr/antlr4-runtime/4.5.3/antlr4-runtime-4.5.3.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[4] = file:/Users/me/.m2/repository/commons-beanutils/commons-beanutils/1.9.2/commons-beanutils-1.9.2.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[5] = file:/Users/me/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[6] = file:/Users/me/.m2/repository/commons-cli/commons-cli/1.3.1/commons-cli-1.3.1.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[7] = file:/Users/me/.m2/repository/com/google/guava/guava/19.0/guava-19.0.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[8] = file:/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/../lib/tools.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[9] = file:/Users/me/.m2/repository/io/project/project-code-style/1.0.5-SNAPSHOT/project-code-style-1.0.5-SNAPSHOT.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[10] = file:/Users/me/.m2/repository/org/spockframework/spock-core/1.0-groovy-2.4/spock-core-1.0-groovy-2.4.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[11] = file:/Users/me/.m2/repository/org/codehaus/groovy/groovy-all/2.4.1/groovy-all-2.4.1.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[12] = file:/Users/me/.m2/repository/junit/junit/4.12/junit-4.12.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[13] = file:/Users/me/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[14] = file:/Users/me/.m2/repository/org/slf4j/slf4j-jdk14/1.5.6/slf4j-jdk14-1.5.6.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[15] = file:/Users/me/.m2/repository/org/slf4j/jcl-over-slf4j/1.5.6/jcl-over-slf4j-1.5.6.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[16] = file:/Users/me/.m2/repository/org/codehaus/plexus/plexus-interactivity-api/1.0-alpha-4/plexus-interactivity-api-1.0-alpha-4.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[17] = file:/Users/me/.m2/repository/backport-util-concurrent/backport-util-concurrent/3.1/backport-util-concurrent-3.1.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[18] = file:/Users/me/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[19] = file:/Users/me/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[20] = file:/Users/me/.m2/repository/org/apache/maven/reporting/maven-reporting-api/3.0/maven-reporting-api-3.0.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[21] = file:/Users/me/.m2/repository/org/apache/maven/reporting/maven-reporting-impl/2.3/maven-reporting-impl-2.3.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[22] = file:/Users/me/.m2/repository/org/apache/maven/shared/maven-shared-utils/0.6/maven-shared-utils-0.6.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[23] = file:/Users/me/.m2/repository/com/google/code/findbugs/jsr305/2.0.1/jsr305-2.0.1.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[24] = file:/Users/me/.m2/repository/org/apache/maven/doxia/doxia-core/1.2/doxia-core-1.2.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[25] = file:/Users/me/.m2/repository/xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[26] = file:/Users/me/.m2/repository/xml-apis/xml-apis/1.3.04/xml-apis-1.3.04.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[27] = file:/Users/me/.m2/repository/org/apache/httpcomponents/httpclient/4.0.2/httpclient-4.0.2.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[28] = file:/Users/me/.m2/repository/org/apache/httpcomponents/httpcore/4.0.1/httpcore-4.0.1.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[29] = file:/Users/me/.m2/repository/commons-codec/commons-codec/1.3/commons-codec-1.3.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[30] = file:/Users/me/.m2/repository/commons-validator/commons-validator/1.3.1/commons-validator-1.3.1.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[31] = file:/Users/me/.m2/repository/commons-digester/commons-digester/1.6/commons-digester-1.6.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[32] = file:/Users/me/.m2/repository/org/apache/maven/shared/maven-shared-resources/2/maven-shared-resources-2.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[33] = file:/Users/me/.m2/repository/org/apache/maven/doxia/doxia-sink-api/1.4/doxia-sink-api-1.4.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[34] = file:/Users/me/.m2/repository/org/apache/maven/doxia/doxia-logging-api/1.4/doxia-logging-api-1.4.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[35] = file:/Users/me/.m2/repository/org/apache/maven/doxia/doxia-decoration-model/1.4/doxia-decoration-model-1.4.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[36] = file:/Users/me/.m2/repository/org/apache/maven/doxia/doxia-site-renderer/1.4/doxia-site-renderer-1.4.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[37] = file:/Users/me/.m2/repository/org/apache/maven/doxia/doxia-module-xhtml/1.4/doxia-module-xhtml-1.4.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[38] = file:/Users/me/.m2/repository/org/apache/maven/doxia/doxia-module-fml/1.4/doxia-module-fml-1.4.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[39] = file:/Users/me/.m2/repository/org/codehaus/plexus/plexus-i18n/1.0-beta-7/plexus-i18n-1.0-beta-7.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[40] = file:/Users/me/.m2/repository/org/apache/velocity/velocity-tools/2.0/velocity-tools-2.0.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[41] = file:/Users/me/.m2/repository/commons-chain/commons-chain/1.1/commons-chain-1.1.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[42] = file:/Users/me/.m2/repository/dom4j/dom4j/1.1/dom4j-1.1.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[43] = file:/Users/me/.m2/repository/sslext/sslext/1.2-0/sslext-1.2-0.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[44] = file:/Users/me/.m2/repository/org/apache/struts/struts-core/1.3.8/struts-core-1.3.8.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[45] = file:/Users/me/.m2/repository/org/apache/struts/struts-taglib/1.3.8/struts-taglib-1.3.8.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[46] = file:/Users/me/.m2/repository/org/apache/struts/struts-tiles/1.3.8/struts-tiles-1.3.8.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[47] = file:/Users/me/.m2/repository/org/apache/maven/doxia/doxia-integration-tools/1.6/doxia-integration-tools-1.6.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[48] = file:/Users/me/.m2/repository/commons-io/commons-io/1.4/commons-io-1.4.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[49] = file:/Users/me/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[50] = file:/Users/me/.m2/repository/org/codehaus/plexus/plexus-resources/1.0.1/plexus-resources-1.0.1.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[51] = file:/Users/me/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.20/plexus-utils-3.0.20.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[52] = file:/Users/me/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.21/plexus-interpolation-1.21.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[53] = file:/Users/me/.m2/repository/org/codehaus/plexus/plexus-velocity/1.1.8/plexus-velocity-1.1.8.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[54] = file:/Users/me/.m2/repository/org/apache/velocity/velocity/1.5/velocity-1.5.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[55] = file:/Users/me/.m2/repository/commons-lang/commons-lang/2.1/commons-lang-2.1.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[56] = file:/Users/me/.m2/repository/oro/oro/2.0.8/oro-2.0.8.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - urls[57] = file:/Users/me/.m2/repository/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - Number of foreign imports: 1
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - import: Entry[import from realm ClassRealm[maven.api, parent: null]]
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli -
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - -----------------------------------------------------
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - -> [Help 1]
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli -
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - To see the full stack trace of the errors, re-run Maven with the -e switch.
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli -
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - For more information about the errors and possible solutions, please read the following articles:
10:00:52.765 [main] ERROR org.apache.maven.cli.MavenCli - [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException

Answer

Somehow the slf4j-simple dependency is conflicting with the logger in the spring-boot-starter-web dependency. I have fixed the issue and is now working with the current pom.

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.3.5.RELEASE</version>
    </parent>
    <dependencies>
        <!-- MAVEN EMBEDDER -->
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-embedder</artifactId>
            <version>3.1.1</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.aether</groupId>
            <artifactId>aether-connector-wagon</artifactId>
            <version>0.9.0.M2</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.wagon</groupId>
            <artifactId>wagon-http-lightweight</artifactId>
            <version>2.5</version>
        </dependency>
        <!-- SPRING BOOT -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
<dependencies>