How to resolve custom created dependencies for springboot project in Jenkins? - java

I have built a custom SDK dependency on my spring-boot project. The project is built without any issue locally once I install dependency which is then cached in .m2.
Now, when I try to build the project in Jenkins running in the server(AWS EC2) I get Could not resolve dependencies for project <project_name>:war:0.0.1-SNAPSHOT: Failure to find <dependency_name>:0.0.1 error.
My pom.xml looks like
<dependency>
<groupId>com.mysdk</groupId>
<artifactId>my-sdk</artifactId>
<version>0.0.1</version>
</dependency>
The issue here is because the dependency is not found when Jenkins builds the project. Can someone help me with how to install this dependency in Jenkins or how to resolve this kind of issue?

actually you could have an artifact repository, so the jenkins can reach your own artifacts, something like Artifactory https://jfrog.com/open-source/, for example.
If you don't want to have your own server, you should create the my-sdk pipeline in Jenkins, when this pipeline intall the artifact, it will be then available for other Jenkins pipeline.

Related

Pom.XML Maven Build Dependency of POM Only Looking for Jar

GIVEN:
I have an in house tool built with gradle that includes a dependency that is only a POM file which in turn then includes a bunch of other dependencies. No jar for this particular dependency by itself. The tool builds.
I have a maven project with a pom.xml file that I want to include this tool in because of all the company specific methods needed for some processes. I added the dependency with the type of pom and when I build it fails.
ERROR:
[ERROR] Failed to execute goal on project <MYPROJECT>: Could not resolve dependencies for project <MYPROJECT>:jar:0.0.326: <com.pom.only.dependency>:jar:7.0 was not found in <Company Repo where this POM file exists> during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of <company repo> has elapsed or updates are forced
REQUEST:
I have tried making the tool a fat jar in the hopes it would not need this. But it does. The my project builds without this tool jar so I know it is this jar that brings in the dependency. I just have no idea how to resolve this.
ALMOST CODE EXAMPLE
Because of company specific, I can not put the exact POM code but I can put what it looks like removing company specific stuff.
<dependency>
<groupId>com.group</groupId>
<artifactId>tools-app</artifactId>
<version>1.0.11</version>
</dependency>
<dependency>
<groupId>com.group</groupId>
<artifactId>pom only dependency</artifactId>
<version>7.0</version>
<type>pom</type>
</dependency>
So tools app is the one that I am pulling it. It is the gradle build and uses the pom only dependency without any issue. If I pull this into a gradle app it works fine and builds. However, in the app that has this in the pom, if fails for above. So I add the dependency for the pom only dependency and mark it as type pom but still get the error.
So for my situation (and not the best solution), I went into the dependency that has only a pom and pulled the dependencies out of there and built. It worked. But feel there should be a way to make it work without having to do this.

Pull dependencies as a jar in maven?

Is there a way I can pull some specific jar directly as a dependency defined in maven?
I have a maven project which has some internal and external dependencies. I am hosting this project on a maven registry so I can consume it in other projects. I am creating a jar and as well as creating "jar-with-dependencies" using the maven-assembly plugin in my project. Then I am hosting this on the maven repository where it has the pom, jar, and jar-with-dependencies all hosted.
In the other maven project, I want to pull the above maven project as a dependency. When I am trying to directly define it as a dependency as mentioned below, it is trying to pull the dependencies of the original project too in which some of the internal ones it could not find. Is there a way so that it can pull the hosted jar-with-dependencies directly or some other solution to this problem.
P.S. I do not want to host all those internal dependencies directly on the maven registry.
Update: I tried adding dependency with the help of the maven classifier to point to jar-with-dependencies. But it still does not resolve the issue
<dependencies>
<dependency>
<groupId>com.myproject.project</groupId>
<artifactId>project-java-sdk</artifactId>
<version>1.0.0-SNAPSHOT</version>
<classifier>jar-with-dependencies</classifier>
</dependency>
</dependencies>

Maven Dependency missing artifact : jhotdraw

I am currently working on a Java project using Maven. In my pom.xml I am getting this error.
Missing artifact org.jhotdraw:jhotdraw:jar:6.0b1
I have added this dependency
<dependency>
<groupId>org.jhotdraw</groupId>
<artifactId>jhotdraw</artifactId>
<version>7.6.0</version>
</dependency>
to my pom.xml. But still the error is same.
Can someone help me?
That version of org.jhotdraw.jhotdraw does not exist on Maven Repository, the last version available on Maven Repository is 7.4.1
Either you have made an error as to the version or group id (I see there is a 7.6.0 package under org.opentcs.thirdparty.jhotdraw, but don't know if it's the same). Alternatively, you may have to manually download and install that package, check out...
How to include custom library into maven local repository

Intellij Maven dependency not found (sqlite-jdbc)

IntelliJ Maven pom.xml I get the following message:
Dependency org.xerial:sqlite-jdbc:3.8.11.1 not found.
How can I fix my problem? This is the only dependency in my pom.xml which doesn't work.
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.8.11.1</version>
</dependency>
after testing in a new Maven Test Project, it works now in my main projec. Thank
Check correctness artifact properties as group artifact and version, if they correct this mean your artifact is not in maven central repo you need manually add new repository in you pom.xml where this artifact present. If you artifact in maven central try to load them manually if you use maven not bundled in intellij install
-> open console in idea with alt + f12 then type mvn dependency:resolve
update
your artifact in central repo, https://mvnrepository.com/artifact/org.xerial/sqlite-jdbc/3.8.11.1
Sometimes i meet this bug in Idea (Idea does not see this dependency because it does not indexed by Idea or something like this, version of artifact highlight red but it is only idea deal) add manually this dependency or try to recheck (clear caches) and all will be work.

Failure with Maven Android : The POM for com.google.android.gms:google-play-services:jar:13.0.0 is missing, no dependency information available

This is the error that I am getting with my current Maven Android Project.
The POM for com.google.android.gms:google-play-services:jar:13.0.0 is missing, no dependency information available
I have tried reinstalling google play services from SDK Manager and running mnv clean install still it does not work.
Any idea how to resolve this.
you need to make sure maven can access the repository the artifact can be found in. For example maven central http://search.maven.org/ does not contain the that artifact.
I would expect a settings.xml or a pom.xml to contain some section in that define where to look for this.
if you can execute maven commands try: mvn help:effective-settings
and as well: mvn help:effective-pom
that should reveal some repositories.
Another issue may be that you need to configure a proxy server for maven if you are behind one.
Is the message a warning or an error? Because it is also common that some artifacts do not have a pom.xml. So if it is a warning but everything else works just ignore it :)

Categories