Missing artifact error when adding a Maven dependency - java

I am not familiar with maven but I need to add a jnativehook dependency in a Java/Jersey project. I tried to add this dependency in my pom.xml
<dependency>
<groupId>com.1stleg</groupId>
<artifactId>system-hook</artifactId>
<version>2.0.3</version>
</dependency>
But I get an error on Eclipse
Missing artifact com.1stleg:system-hook:jar:2.0.3

According this, it should be:
<dependency>
<groupId>com.1stleg</groupId>
<artifactId>jnativehook</artifactId>
<version>2.0.3</version>
</dependency>
instead of
<dependency>
<groupId>com.1stleg</groupId>
<artifactId>system-hook</artifactId>
<version>2.0.3</version>
</dependency>
Hope it helps!

Related

Maven Dependencies .jar non existing library

The container 'Maven Dependencies' references non existing library 'C:\.m2\repository\com\portal\pcm\12.0.3\pcm-12.0.3.jar'
If i check the folder there are files that have the same name as the jar but end on jar.lastUpdated.
I tried maven clean and maven update which did not work. I delete the *.jar.lastUpdated in m2, but did not work too.
The line in my pom.xml is:
Missing artifact com.portal:pcm:jar:12.0.3
Missing artifact com.portal:pcmext:jar:12.0.3
Missing artifact com.portal:pcmext:jar:12.0.3
This block is the one with the marker where it states the artifact is missing.
<dependency>
<groupId>com.portal</groupId>
<artifactId>pcm</artifactId>
<version>12.0.3</version>
</dependency>
<dependency>
<groupId>com.portal</groupId>
<artifactId>pcmext</artifactId>
<version>12.0.3</version>
</dependency>
<dependency>
<groupId>com.portal</groupId>
<artifactId>pfc</artifactId>
<version>12.0.3</version>
</dependency>
I tried to use a version suggested by mvnrepository.com/artifact/com.portal.pcm/pcm/7.5, but didnt work too.
<dependency>
<groupId>com.portal.pcm</groupId>
<artifactId>pcm</artifactId>
<version>7.5</version>
</dependency>
<dependency>
<groupId>com.portal.pcm</groupId>
<artifactId>pcmext</artifactId>
<version>7.5</version>
</dependency>
<dependency>
<groupId>com.portal.pcm</groupId>
<artifactId>pfc</artifactId>
<version>7.5</version>
</dependency>
i guess dependency configuration is incorrect, but which is correct?

maven build failing to download com.lowagie:itext:jar:2.1.7.js6 dependency

Previously my build is running fine but all of a sudden it's failing with the below error.
Failed to collect dependencies at ar.com.fdvs:DynamicJasper:jar:5.3.0 -> net.sf.jasperreports:jasperreports:jar:6.8.0 -> com.lowagie:itext:jar:2.1.7.js6: Failed to read artifact descriptor for com.lowagie:itext:jar:2.1.7.js6: Could not transfer artifact com.lowagie:itext:pom:2.1.7.js6 from/to maven-default-http-blocker (http://0.0.0.0/): Blocked mirror for repositories: [jaspersoft-third-party (http://jaspersoft.jfrog.io/jaspersoft/third-party-ce-artifacts/, default, releases+snapshots), jr-ce-releases (http://jaspersoft.jfrog.io/jaspersoft/jr-ce-releases, default, releases+snapshots)] -> [Help 1]
[ERROR]
These are the dependencies I am using in my code.
<dependency>
<groupId>com.lowagie</groupId>
<artifactId>itext</artifactId>
<version>2.1.7.js6</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>ar.com.fdvs</groupId>
<artifactId>DynamicJasper</artifactId>
<version>5.3.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/ar.com.fdvs/DynamicJasper-core-fonts -->
<dependency>
<groupId>ar.com.fdvs</groupId>
<artifactId>DynamicJasper-core-fonts</artifactId>
<version>2.0</version>
</dependency>
I tried changing the DynamicJasper version also but no luck.
In the docker file, I am using the below image as a base image.
FROM maven:3.6.0-jdk-11-slim AS build
if you run maven on linux .then use this
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>6.12.1</version>
<exclusions>
<exclusion>
<groupId>com.lowagie</groupId>
<artifactId>itext</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- "jasperreports" can't resolve "itext" dependency on jenkins.so it added independently-->
<dependency>
<groupId>com.lowagie</groupId>
<artifactId>itext</artifactId>
<version>2.1.7</version>
</dependency>
<dependency>
<groupId>com.lowagie</groupId>
<artifactId>itext</artifactId>
<version>4.2.0</version>
</dependency>
My issue resolved after adding this dependency.
The modified versions of iText 2.1.7 are available on this public repository:
https://jaspersoft.jfrog.io/ui/native/third-party-ce-artifacts/com/lowagie/itext
Jars are available for downloading.
It looks like there is error in downloading com.lowagie:itext:pom:2.1.7.js6. I think there is a version number change in maven repository. there is not any 2.1.7.js6 version in maven repository.
<!-- https://mvnrepository.com/artifact/com.lowagie/itext -->
<dependency>
<groupId>com.lowagie</groupId>
<artifactId>itext</artifactId>
<version>2.1.7</version>
</dependency>
for your ref:
https://mvnrepository.com/artifact/com.lowagie/itext/2.1.7
Try to remove this dependency folder from users\.m2 folder and run maven install again. This will remove the old dependency which is causing issues and will download the same dependency again.

What is the dependancy for EmbeddedActiveMQBroker?

I'm new to Maven and not sure how to write dependancies for my pom.xml
I am trying to use the following class:
import org.apache.activemq.junit.EmbeddedActiveMQBroker;
And this is my attempt at writing a dependancy:
<dependency>
<groupId>org.apache</groupId>
<artifactId>activemq-junit</artifactId>
<version>5.15.9</version>
</dependency>
But I am still getting an error
Try with the following.
<dependency>
<groupId>org.apache.activemq.tooling</groupId>
<artifactId>activemq-junit</artifactId>
<version>5.13.1</version>
<scope>test</scope>
</dependency>
You can get the details from mvnrepository.com.
First of all we go to the official Maven Dependencies Page of ActiveMQ - https://mvnrepository.com/artifact/org.apache.activemq/activemq-broker/5.15.9.
Then, we go to the "Test Dependencies" category, where we clearly can see the JUnit artifact.
so, use in your pom.xml file next dependency for version 5.15.19:
<!-- https://mvnrepository.com/artifact/org.apache.activemq/activemq-broker -->
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-broker</artifactId>
<version>5.15.9</version>
</dependency>
UPDATE
Add also the next dependency:
<!-- https://mvnrepository.com/artifact/org.apache.activemq.tooling/activemq-junit -->
<dependency>
<groupId>org.apache.activemq.tooling</groupId>
<artifactId>activemq-junit</artifactId>
<version>5.15.9</version>
<scope>test</scope>
</dependency>

Maven cannot load dependency from another dependency in repository

I am new to Maven, I try to load tranquility using the following in pom.xml:
<dependency>
<groupId>io.druid</groupId>
<artifactId>tranquility-core_2.11</artifactId>
<version>0.7.0</version>
</dependency>
Then I get an error: Failure to find com.fasterxml.jackson-module-scala_2.11:jar:2.4.6.
I tried to search in search.maven.org, and find out that, inside the io.druid tranquility-core module, the dependency is:
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-scala_2.11</artifactId>
<version>2.4.6</version>
</dependency>
However, when I try to search Jackson-module-scala_2.11 in the central repository, there's no 2.4.6 version there, there's only 2.4.5 and 2.5.0. See the following link: http://search.maven.org/#search|gav|1|g%3A%22com.fasterxml.jackson.module%22%20AND%20a%3A%22jackson-module-scala_2.11%22
So is there a way for me to build it successfully even the module in central repository (in this case the tranquility module) makes mistake in referencing another module?
Thanks.
you can exclude the dependency in the io.druid tranquility, and dependency it by yourself with the exist version like this:
<dependency>
<groupId>io.druid</groupId>
<artifactId>tranquility-core_2.11</artifactId>
<version>0.7.0</version>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-scala_2.11</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-scala_2.11</artifactId>
<version>2.5.0</version>
</dependency>

Eclipse Maven Dependency issue

I have maven-depenencies folder which lists over 50+ jars I need for compile and testing on my local. In addition POM.xml have specific (see snippet) which lists the dependencies I wanted in "target/final_build.jar". I do not want rest of maven - dependencies I can see on eclipse IE. I just want following packaged as aprt of final jar..
What is the easy way to accomplish . I tried copy-dependencies but it copied all Maven dependencies and not the 4 listed in pom.xml. More over they are copied over to lib/src folder.
Desired state is to just have 4 dependencies mentioned below are part of "target/outputfile.jar"
<dependencies>
<dependency>
<groupId>org.twitter4j</groupId>
<artifactId>twitter4j-core</artifactId>
<version>3.0.3</version>
</dependency>
<dependency>
<groupId>org.twitter4j</groupId>
<artifactId>twitter4j-stream</artifactId>
<version>3.0.3</version>
</dependency>
</dependencies>
Dependencies that are needed for compile/test but not for the application (because the (EE-/JDK-/?-) Container already have this classes) can be specified by the dependency scope provided:
<dependencies>
<dependency>
<groupId>org.twitter4j</groupId>
<artifactId>twitter4j-core</artifactId>
<version>3.0.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.twitter4j</groupId>
<artifactId>twitter4j-stream</artifactId>
<version>3.0.3</version>
<scope>provided</scope>
</dependency>
</dependencies>

Categories