could not find artifact while running maven build in jenkins - jenkins

While building the maven application in jenkins i get the following error
[ERROR] Artifact: com.envoisolutions.sxc:sxc-runtime:jar:0.7.3-osgi has no file.
org.apache.maven.artifact.resolver.ArtifactNotFoundException: Could not find artifact com.envoisolutions.sxc:sxc-runtime:jar:0.7.3-osgi in central (http://repo.maven.apache.org/maven2)
org.apache.maven.artifact.resolver.ArtifactNotFoundException: Could not find artifact xpp3:xpp3_min:jar:1.1.3.4.O-osgi in central (http://repo.maven.apache.org/maven2)
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=xpp3 -DartifactId=xpp3_min -Dversion=1.1.3.4.O-osgi -Dpackaging=jar -Dfile=/path/to/file
Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=xpp3 -DartifactId=xpp3_min -Dversion=1.1.3.4.O-osgi -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
xpp3:xpp3_min:jar:1.1.3.4.O-osgi
from the specified remote repositories:
central (http://repo.maven.apache.org/maven2, releases=true, snapshots=false),
codehaus-releases (http://repository.codehaus.org/, releases=true, snapshots=true),
java.net (http://download.java.net/maven/2/, releases=true, snapshots=true),
central (http://repo.maven.apache.org/maven2, releases=true, snapshots=false)
Is there any way to restrict the search of maven to few repos ?

This artifact seems to be very old.
I found it in this Maven repository :
https://teamcity-systeme.lip6.fr/nexus/content/groups/public
Add this repo to your Maven's pom.

Related

Gradle build fails using Jenkins, succeeds manually

I'm trying to create a Jenkins task to build my Gradle project.
Cloning the git repo and using the Gradle wrapper of the project works fine.
But when it tries to run the gradle task named buildProduction, fails with the following error:
Plugin [id: 'com.jfrog.artifactory', version: '4.7.2', apply: false] was not found in any of the following sources:
- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (could not resolve plugin artifact 'com.jfrog.artifactory:com.jfrog.artifactory.gradle.plugin:4.7.2')
Searched in the following repositories:
Gradle Central Plugin Repository
The interesting thing is when I manually run this Gradle task (inside the Jenkins workspace where the repo is cloned) like this:
gradlew buildProduction it works perfectly and is able to fetch all the plugins and dependencies.

Isolate maven jar dependencies that are unavailable from maven central

I am attempting to refactor a maven build process, and I am trying to populate a local maven repository to help with this refactor.
My build depends on obsolete versions of jar files that exist only in a maven repo on my network (not in maven central). Example: org.foo:example:1.7:jar
I have been attempting to run my maven build in a docker image image with the hope that I could identify all of the obsolete components being pulled from my maven repository.
My goal is to explicitly pull down dependencies from my maven repo and then build the application using only maven central as an external repository.
I have a docker file to run the build
FROM maven:3-jdk-8 as build
WORKDIR /build
# This pom.xml file only references maven central.
COPY pom.xml .
# Explicitly download artifacts into /root/.m2/...
RUN mvn dependency:get -Dartifact=org.foo:example:1.7.jar \
-DrepoUrl=https://my.maven.repo
# Run the build making use of the dependencies loaded into the local repo
RUN mvn install
Unfortunately, I see an error: could not resolve dependencies for project ... The following artifacts could not be resolved: org.foo:example:jar:1.7.
I presume there might be some metadata in my local org.foo:example:1.7:pom that has an awareness of its origin repository. I had hoped I could satisfy this dependency by pulling it into my local repository.
I also attempted to add the following flag
RUN mvn install --no-snapshot-updates
After further investigation, I discovered that the downloads in my .m2/repository contained files named _remote.repositories.
Solution: set -Dmaven.legacyLocalRepo=true when running dependency:get
With this flag, the _remote.repositories files are not created.
RUN mvn dependency:get -Dmaven.legacyLocalRepo=true \
-Dartifact=org.foo:example:1.7.jar \
-DrepoUrl=https://my.maven.repo
This question helped to provide a solution: _remote.repositories prevents maven from resolving remote parent

Deploying the root pom.xml to artifactory via jenkins?

I'm uploading from jenkins to artifactory and my whole maven project is built with:
mvn clean install
The project has
Result of the Deploy to Artifactory:
How do I get the root pom.xml to the artifactory? I reference this from other project and it does not build because of it. All the other modules are deployed and their POMs as well.
It seems that the reason that it did not work was that I had included an include pattern in the deploy maven artifacts, I removed the ".xml, *.jar" and it deployed correctly.

Travis-CI resolving non-maven-central JARS

I have a JAR which isn't in maven central, thus travis ci fails with the below:
Unresolveable build extension: Plugin
org.kie:kie-maven-plugin:6.2.0.Final or one of its dependencies could
not be resolved: The following artifacts could not be resolved:
org.jbpm:jbpm-bpmn2:jar:6.0.3-redhat-6,
org.drools:drools-decisiontables:jar:6.0.3-redhat-6: Could not find
artifact org.jbpm:jbpm-bpmn2:jar:6.0.3-redhat-6 in central
(https://repo.maven.apache.org/maven2) -> [Help 2]
The jar is located #
https://maven.repository.redhat.com/nexus/content/groups/product-techpreview/org/jbpm/jbpm-bpmn2/
How can i tell travis-ci to use this repo?
Fixed by adding missing repos[1]
[1]https://github.com/garethahealy/poms/blob/master/pom.xml#L760

Building a Maven Project with Files in a Local Repo

I've installed two libraries to my local repository (JGraph and JGraphtT). I used this command:
mvn install:install-file -DgroupId=org.jgrapht -DartifactId=jgrapht -Dversion=0.8.3 -Dpackaging=jar -Dfile=./jgrapht.jar
and similar for JGraph. I can see that the two Jar files are in my local repository.
When I try to create Eclipse classpath and build files from the directory of my project's POM file (using mvn eclipse:eclipse), I get this error:
[WARNING] Missing POM for org.jrapht:jgrapht:jar:0.8.3
and similar for JGraph.
Any ideas on what I'm doing wrong? My settings.xml file has the local repository enabled.
Thanks,
Keith

Resources