I'm newbie on maven.
My question is this:
I have a far jar in nexus, and want to add it as dependency in a pom.xml.
How can I do that?
In nexus there are both the jar and the fat jar.
Inside my pom.xml I'm using:
<dependency>
<groupId>com.xxxxxxxxxxxx.sar</groupId>
<artifactId>kafka-connector</artifactId>
<version>5.0.0-SNAPSHOT</version>
</dependency>
and, of course, it is not downloading the fat jar.
How do I fix that?
Using a classifier is the right way to go:
<dependency>
<groupId>com.xxxxxxxxxxxx.sar</groupId>
<artifactId>kafka-connector</artifactId>
<version>5.0.0-SNAPSHOT</version>
<classifier>fat</classifier>
</dependency>
I would check if the fat is a consumable artifact.
add the dependency to your pom.xml
<dependency>
<groupId>com.xxxxxxxx</groupId>
<artifactId>example-app</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${basedir}/lib/yourJar.jar</systemPath>
Related
i have added a dependency in my pom.xml like:
<dependency>
<groupId>com.excample</groupId>
<artifactId>someJar</artifactId>
<version>${version}</version>
</dependency>
inside that jar, in META-INF\maven\com.excample\someJar\ dir, there is another pom.xml.
when i run mvn clean install all its dependencies not getting downloaded or added to classpath.
Is there any reason for that?
Thanks in advance.
I am currently having an issue with IntelliJ.
I have several dependencies in my pom. However, when I generate an artifact, I can add the maven libraries but instead of maven extracting the jar contents, Maven instead pops the entire jar into the artifact jar. This results in my program failing to load. How can I get IntelliJ to not do this and instead extract the jar contents into the build?
I configured the artifact manually through intelliJ
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.5</version>
<scope>compile</scope>
</dependency>
Thank you.
Ive included following lines in my pom.xml
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>4.1.6.RELEASE</version>
</dependency>
The specific spring-core JAR version I want is 4.1.6, but whenever I do an mvn clean install, the dependencies folder under my project in netbeans shows a downgraded version (currently 3.0.7.RELEASE).
I want to know how I can force maven to put 4.1.6.RELEASE jar in my dependencies folder. I've done
mvn dependency:purge-local-repository -DactTransitively=false -DreResolve=false
And I've the folder 4.1.6.RELEASE with correct jar in my local /.m2/repositories folder. I need to access org.springframework.util.MimeType class which is not available in spring-core 3.0.7.RELEASE jar.
See the result of mvn dependency:tree to know if another jar bring back the version 3.0.7. and exclude from this dependency the spring-core
See the same result to know if the right version is present
Add the pom.xml and the result of mvn dependency:tree in the question
Please follow these steps:
Check in .m2 local repository where the Spring 3.0.7 jar is downloaded(It should be under folder org->springframework)
Delete the folder present inside springframework, so that mvn will try to fetch required dependencies.
Let me know if it helps
The issue is that spring-core is a mandatory dependenecy of most spring artifacts. Most likely you are using a dependent artifact e.g spring-context which is of version 3.0.7. Then Maven is fetching spring-core of the same version as the dependent artifact using its transitive dependency mechanism.
To control the version of spring-core you need to move its declaration from the dependencies section to the dependency management section of your pom.xml as follows
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>4.1.6</version>
</dependency>
</dependencies>
</dependencyManagement>
I have two projects a war project(A) and a jar project(B).
War project is dependent on jar project and
dependency in pom.xml of A is defined as
<dependency>
<groupId>a.b.c</groupId>
<artifactId>B-core</artifactId>
<version>${B-core-version}</version>
</dependency>
Now when I build War Project A, I wish that
I dont need to define the dependencies
already defined in B e;g
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>${mockito-version}</version>
<scope>test</scope>
</dependency>
defined in pom of Jar Project B should be Available for Project A.
But what is currently happening is I have to repeat the dependencies
in both the projects. Is there a way around for it?
First create a jar of B project, install it in maven repository and then add a new dependency in war B project's pom.xml.
<dependency>
<groupId>a.b.c</groupId>
<artifactId>B-core</artifactId>
<version>1.0</version>
</dependency>
--EDIT--
By removing <scope>test</scope> will solve your problem.
For more information read about Introduction to the Dependency Mechanism
My project doesn't reference the groovy-all-1.8.3.jar, and the jar is not in the maven dependency tree and .classpath file.
When the project is imported to Eclipse, it notices that the groovy-all-1.8.3.jar is referenced.
How can the jar be referenced?
In the Maven Project put the following dependency in pom.xml
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>1.8.3</version>
</dependency>
And run mvn clean install , It solves your problem.