I'm trying to include with maven dependency for
<dependency>
<groupId>org.jacorb</groupId>
<artifactId>jacorb</artifactId>
<version>2.3.1</version>
</dependency>
Dependency is resolved, but it's causing problem with another dependency, picocontainer:
[ERROR] Failed to execute goal on project s_s: Could not resolve dependencies
for project my.package:s_s:war:1: Failed to collect dependencies for org.jacorb:jacorb:jar:2.3.1 (compile), picocontainer:picocontainer:jar:1.2 (compile)]: Failed to read artifact descriptor for picocontainer:picocontainer:jar:${picocontainer.version}: Could not transfer artifact picocontainer:picocontainer:pom:${picocontainer.version} from/to central (http://repo.maven.apache.org/maven2): IllegalArgumentException: Illegal character in path at index 65: http://repo.maven.apache.org/maven2/picocontainer/picocontainer/${picocontainer.version}/picocontainer-${picocontainer.version}.pom -> [Help 1]
When I check local repo, version named ${picocontainer.version} is created. I've tried include own dependency:
<dependency>
<groupId>picocontainer</groupId>
<artifactId>picocontainer</artifactId>
<version>1.2</version>
</dependency>
But it's not helping, could someone help me out?
OK I figured it out :) I ought to exclude dependency from org.jacorb like this:
<dependency>
<groupId>org.jacorb</groupId>
<artifactId>jacorb</artifactId>
<version>2.3.1</version>
<exclusions>
<exclusion>
<groupId>picocontainer</groupId>
<artifactId>picocontainer</artifactId>
</exclusion>
<exclusion>
<groupId>picocontainer</groupId>
<artifactId>picocontainer-tck</artifactId>
</exclusion>
<exclusion>
<groupId>picocontainer</groupId>
<artifactId>picocontainer-gems</artifactId>
</exclusion>
</exclusions>
</dependency>
And include necessary one
<dependency>
<groupId>picocontainer</groupId>
<artifactId>picocontainer</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>picocontainer</groupId>
<artifactId>picocontainer-tck</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>picocontainer</groupId>
<artifactId>picocontainer-gems</artifactId>
<version>1.2</version>
</dependency>
I guess it's maven corrupted artifact?
Related
I'm using maven version 3.6.2 to build my project, it has multiple layers of dependencies and finally depends on ~/.m2/repository/com/nimbusds/nimbus-jose-jwt/5.10/nimbus-jose-jwt-5.10.pom
<dependency>
<groupId>net.minidev</groupId>
<artifactId>json-smart</artifactId>
<version>[1.3.1,2.3]</version>
</dependency>
I got compile failed: com.nimbusds:nimbus-jose-jwt:jar:5.10 -> net.minidev:json-smart:jar:2.3-SNAPSHOT: Failed to read artifact descriptor for net.minidev:json-smart:jar:2.3-SNAPSHOT: Failure to find net.minidev:minidev-parent:pom:2.3-SNAPSHOT...
If I manually update ~/.m2/repository/com/nimbusds/nimbus-jose-jwt/5.10/nimbus-jose-jwt-5.10.pom to use <version>2.3</version> instead of <version>[1.3.1,2.3]</version>then it can compile fine. Why maven cannot interpret [1.3.1,2.3] correctly?
I use this to solve the program, refer https://bitbucket.org/connect2id/nimbus-jose-jwt/issues/388/json-smart-pom-23-snapshot
<dependency>
<groupId>com.nimbusds</groupId>
<artifactId>nimbus-jose-jwt</artifactId>
<version>5.10</version>
<!--参考https://bitbucket.org/connect2id/nimbus-jose-jwt/issues/388/json-smart-pom-23-snapshot-->
<exclusions>
<exclusion>
<groupId>net.minidev</groupId>
<artifactId>json-smart</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>net.minidev</groupId>
<artifactId>json-smart</artifactId>
<version>2.3</version>
</dependency>
The following is the error I see, what confused me is that why it would depends on 2 versions of my-engine dependency. One is 0.9.0-20180510.015454-2 and another is 0.9.0-SNAPSHOT.
Heres's the command I use:
mvn clean install -DskipTests
In the pom.xml, I specify the version as ${project.version} which here should be 0.9.0-SNAPSHOT. Could you anyone help me ? Thanks
[INFO] --- maven-enforcer-plugin:1.3.1:enforce (enforce) # zeppelin-server ---
[WARNING]
Dependency convergence error for org.apache.hadoop:hadoop-client:2.7.3 paths to dependency are:
+-myproject:my-server:0.9.0-SNAPSHOT
+-myproject:my-engine:0.9.0-20180510.015454-2
+-org.apache.hadoop:hadoop-client:2.7.3
and
+-myproject:my-server:0.9.0-SNAPSHOT
+-myproject:my-engine:0.9.0-SNAPSHOT
+-org.apache.hadoop:hadoop-client:2.7.5
Here's the dependency in pom.xml
<dependency>
<groupId>myproject</groupId>
<artifactId>my-zengine</artifactId>
<version>${project.version}</version>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>my-zengine</artifactId>
<version>${project.version}</version>
</dependency>
You could fix this in one of two ways, either choose to ignore it
mvn clean install -Denforcer.fail=false
or add both wildcard exclusion and exclusion for every dependency that caused the enforcer in the first place as follows.
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-tools-api</artifactId>
<version>2.5.1</version>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-client</artifactId>
</exclusion>
</exclusions>
I am converting our Jenkins Freestyle build to Declarative Pipeline mode. I am using the same POM files.
But whenever i run the pipeline build, i see that the desired war is missing a transitive dependency. The Freestyle build includes that missing dependency however.
The Main parent POM includes:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>net.sf.dozer</groupId>
<artifactId>dozer</artifactId>
<version>5.5.1</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</dependencyManagement>
The second parent includes section below, :
<dependencies>
<dependency>
<groupId>net.sf.dozer</groupId>
<artifactId>dozer</artifactId>
</dependency>
</dependencies>
For both build processes, the dozer artifact is contained in the war file. But dozer contains a dependency of its own:
<dependencies>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.9.1</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
It is this commons-beanutils that I am missing from my final war when i do the Pipeline build. Since I am using the same POM files for both build processes, how can this be possible?
Please help
I have the following in my pom
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.4.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<version>1.0-groovy-2.4</version>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>org.codehaus.groovy</artifactId>
<groupId>groovy-all</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-spring</artifactId>
<version>1.0-groovy-2.4</version>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>org.codehaus.groovy</artifactId>
<groupId>groovy-all</groupId>
</exclusion>
</exclusions>
</dependency>
Basically, I want to force my second and third dependencies to use the version of groovy-all that I'm setting in my first dependency. Is there a better way to do this than setting an exclusion on each of them?
Since as a first dependency you're explicitly defining a version of the groovy-all dependency, this will override the version of this dependency for all transitive dependencies needing this exact dependency. Hence, you won't have to define explicit exclusions.
To validate this, you can run the following before and after the change:
mvn dependency:tree -Dverbose
And compare the output.
Fix is to lock down the version, either via a direct dependency, or a dependency-management section.
I am building a spring-boot application using an alternative to tomcat related stuff (jetty instead of tomcat and hikariCP instead of tomcat-jdbc) and want to exclude them from my dependencies written in pom.xml
I did that for 2 of the packages as shown below -
<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>
<exclusions>
<exclusion>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jdbc</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>2.6.0</version>
</dependency>
But there is some dependency which is including tomcat-jdbc as part of it.
Is there a way to debug that and find out which dependency is including tomcat jdbc as part of it?
mvn dependency:tree
If you run mvn dependency:tree, you will see that there are now a number of additional dependencies.