java - How to struggle dependencies problems in maven -
i have error maven-jetty-plugin. think problem happens because of transit dependencies plugin, conflict new libraries. error appeared after changed jersey1 jersey2 , changed dependencies com.sun org.glassfish server client/core/rs-ws, etc.
[error] failed execute goal org.eclipse.jetty:jetty-maven-plugin:9.3.0.m2:run (default-cli) on project plentify: execution default-cli of goal org.eclipse.je tty:jetty-maven-plugin:9.3.0.m2:run failed: api incompatibility encounter ed while executing org.eclipse.jetty:jetty-maven-plugin:9.3.0.m2:run: java.lang. nosuchmethoderror: javax.ws.rs.core.application.getproperties()ljava/util/map; [error] ----------------------------------------------------- [error] realm = plugin>org.eclipse.jetty:jetty-maven-plugin:9.3.0.m2 [error] strategy = org.codehaus.plexus.classworlds.strategy.selffirststrategy [error] urls[0] = file:/c:/users/stepan/.m2/repository/org/eclipse/jetty/jetty-m aven-plugin/9.3.0.m2/jetty-maven-plugin-9.3.0.m2.jar [error] urls[1] = file:/c:/users/stepan/.m2/repository/org/sonatype/sisu/sisu-in ject-bean/2.1.1/sisu-inject-bean-2.1.1.jar [error] urls[2] = file:/c:/users/stepan/.m2/repository/org/sonatype/sisu/sisu-gu ice/2.9.4/sisu-guice-2.9.4-no_aop.jar [error] urls[3] = file:/c:/users/stepan/.m2/repository/org/codehaus/plexus/plexu s-utils/2.0.6/plexus-utils-2.0.6.jar [error] urls[4] = file:/c:/users/stepan/.m2/repository/org/sonatype/aether/aethe r-util/1.11/aether-util-1.11.jar [error] urls[5] = file:/c:/users/stepan/.m2/repository/org/codehaus/plexus/plexu s-interpolation/1.14/plexus-interpolation-1.14.jar [error] urls[6] = file:/c:/users/stepan/.m2/repository/org/codehaus/plexus/plexu s-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar [error] urls[7] = file:/c:/users/stepan/.m2/repository/org/sonatype/plexus/plexu s-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar [error] urls[8] = file:/c:/users/stepan/.m2/repository/org/sonatype/plexus/plexu s-cipher/1.4/plexus-cipher-1.4.jar [error] urls[9] = file:/c:/users/stepan/.m2/repository/org/apache/maven/plugin-t ools/maven-plugin-tools-api/3.1/maven-plugin-tools-api-3.1.jar [error] urls[10] = file:/c:/users/stepan/.m2/repository/backport-util-concurrent /backport-util-concurrent/3.1/backport-util-concurrent-3.1.jar [error] urls[11] = file:/c:/users/stepan/.m2/repository/org/eclipse/jetty/jetty- util/9.3.0.m2/jetty-util-9.3.0.m2.jar
and on...
can answer how avoid kind of errors? thanks.
update1: http://pastebin.com/ag2zdish link full pom
<dependencies> <dependency> <groupid>junit</groupid> <artifactid>junit</artifactid> <version>3.8.1</version> <scope>test</scope> </dependency> <!-- jpa sql implementation --> <dependency> <groupid>org.eclipse.persistence</groupid> <artifactid>eclipselink</artifactid> <version>2.5.0-rc1</version> <exclusions> <exclusion> <groupid>org.eclipse.persistence</groupid> <artifactid>commonj.sdo</artifactid> </exclusion> </exclusions> </dependency> <!-- jpa nosql implementation --> <dependency> <groupid>org.eclipse.persistence</groupid> <artifactid>org.eclipse.persistence.nosql</artifactid> <version>2.6.0</version> </dependency> <!-- http requests core --> <dependency> <groupid>org.apache.httpcomponents</groupid> <artifactid>httpclient</artifactid> <version>4.4</version> </dependency> <!-- common input output operations --> <dependency> <groupid>org.apache.commons</groupid> <artifactid>commons-io</artifactid> <version>1.3.2</version> </dependency> <!-- java bean json , vice versa implementation --> <dependency> <groupid>com.google.code.gson</groupid> <artifactid>gson</artifactid> <version>2.3</version> <type>jar</type> </dependency> <!-- mysql driver jdbc implementation --> <dependency> <groupid>mysql</groupid> <artifactid>mysql-connector-java</artifactid> <version>5.1.35</version> </dependency> <!-- mongo driver --> <dependency> <groupid>org.mongodb</groupid> <artifactid>mongo-java-driver</artifactid> <version>3.0.0</version> </dependency> <!-- logging --> <dependency> <groupid>log4j</groupid> <artifactid>log4j</artifactid> <version>1.2.17</version> </dependency> <dependency> <groupid>org.slf4j</groupid> <artifactid>slf4j-simple</artifactid> <version>1.6.1</version> </dependency> <dependency> <groupid>log4j</groupid> <artifactid>apache-log4j-extras</artifactid> <version>1.0</version> </dependency> <!-- servlet container --> <dependency> <groupid>com.sun.jersey</groupid> <artifactid>jersey-json</artifactid> <version>${jersey.version}</version> </dependency> <!-- xml json web components --> <dependency> <groupid>javax.ws.rs</groupid> <artifactid>javax.ws.rs-api</artifactid> <version>2.0</version> <type>jar</type> </dependency> <dependency> <groupid>org.glassfish.jersey.core</groupid> <artifactid>jersey-client</artifactid> <version>2.17</version> </dependency> <dependency> <groupid>javax.enterprise</groupid> <artifactid>cdi-api</artifactid> <version>1.2</version> </dependency> <dependency> <groupid>org.glassfish.jersey.core</groupid> <artifactid>jersey-server</artifactid> <version>2.17</version> </dependency> <dependency> <groupid>org.glassfish.jersey.core</groupid> <artifactid>jersey-common</artifactid> <version>2.17</version> </dependency> <dependency> <groupid>org.glassfish.jersey.containers</groupid> <artifactid>jersey-container-servlet-core</artifactid> <version>2.17</version> </dependency> <dependency> <groupid>javax.servlet</groupid> <artifactid>javax.servlet-api</artifactid> <version>3.1.0</version> </dependency> <!-- authorization --> <dependency> <groupid>org.apache.oltu.oauth2</groupid> <artifactid>org.apache.oltu.oauth2.authzserver</artifactid> <version>${oltu.version}</version> </dependency> <dependency> <groupid>org.apache.oltu.oauth2</groupid> <artifactid>org.apache.oltu.oauth2.resourceserver</artifactid> <version>${oltu.version}</version> </dependency> <dependency> <groupid>org.apache.oltu.oauth2</groupid> <artifactid>org.apache.oltu.oauth2.common</artifactid> <version>${oltu.version}</version> </dependency> <dependency> <groupid>org.apache.commons</groupid> <artifactid>commons-lang3</artifactid> <version>3.0</version> </dependency> <!-- scheduler --> <dependency> <groupid>org.quartz-scheduler</groupid> <artifactid>quartz</artifactid> <version>2.2.1</version> </dependency> <dependency> <groupid>org.quartz-scheduler</groupid> <artifactid>quartz-jobs</artifactid> <version>2.2.1</version> </dependency> <!-- mail --> <dependency> <groupid>javax.mail</groupid> <artifactid>mail</artifactid> <version>1.4</version> </dependency> <!-- query --> <dependency> <groupid>org.apache.activemq</groupid> <artifactid>activemq-core</artifactid> <version>5.7.0</version> </dependency> <!-- cache --> <dependency> <groupid>com.whalin</groupid> <artifactid>memcached-java-client</artifactid> <version>3.0.2</version> </dependency> </dependencies>
never mix com.sun.jersey
(1.x) dependencies org.glassfish.jersey
(2.x) dependencies. incompatible. error seeing result of mixing these together.
all need basic jersey functionality
<dependency> <groupid>org.glassfish.jersey.containers</groupid> <artifactid>jersey-container-servlet</artifactid> <version>2.17</version> </dependency>
you can rid of rest (of jersey dependencies) have. json (jackson) support, use
<dependency> <groupid>org.glassfish.jersey.media</groupid> <artifactid>jersey-media-json-jackson</artifactid> <version>2.17</version> </dependency>
for embedded jetty (noticed pom packaging "jar") configuration, see this complete example. jacksonfeature
configure jackson support json.
edit
after looking @ pom again. don't see jetty dependencies, aside plugin. maybe you're aren't trying run embedded instance. web.xml configuration, can use startup
<servlet> <servlet-name>jersey-serlvet</servlet-name> <servlet-class>org.glassfish.jersey.servlet.servletcontainer</servlet-class> <init-param> <param-name>jersey.config.server.provider.packages</param-name> <param-value> you.can.list.a.comma.separated, list.of.packages.to.scan.for, resources.and.providers </param-value> </init-param> <!-- doesn't need included. showing how add manually. --> <init-param> <param-name>jersey.config.server.provider.classnames</param-name> <param-value> org.glassfish.jersey.jackson.jacksonfeature </param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>jersey-serlvet</servlet-name> <url-pattern>/api/*</url-pattern> </servlet-mapping>
one thing looks odd me have packaging jar
. sure shouldn't war
(as seems jetty plugin configuration, running webapp).
Comments
Post a Comment