Gradle build fails using Jenkins, succeeds manually - jenkins

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.

Related

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.

Download/Copy zip file from Nexus repository via jenkins pipeline

I am new to this. I have a .NET project, GIT is being used as a SCM. We are keeping Third party binaries(in a zip file) inside Nexus.
Now, while building the project, via Jenkins, I need to copy and unzip binaries from Nexus to build machine via Jenkins Pipeline Script.
You can use the Maven dependency plugin.
A very basic example would be:
sh "mvn dependency:get -DrepoUrl=YOUR_URL Dartifact=com.foo.something:component:LATEST:jar -Ddest=component.jar"
Of course this requires java and maven to be properly installed on your node.

Is there any maven command can run on Jenkins shell to analyze typescript code in SonarQube?

I want to do static code analyze for typescript Jenkins job using SonarQube. I can do it by installing tsLint lib to my project and compile gulp file in Jenkins, but I think it is not a developer friendly method. Is there any maven command can run on Jenkins shell to analyze typescript code in SonarQube.
you can use this sonarqube plug-in https://github.com/Pablissimo/SonarTsPlugin... This plugin works with tslint but it is no official sonarqube plugin... In my case it works perfectly

POM not released using Jenkins and Artifactory Release

We're trying to use the Artifactory release process in Jenkins to publish a jar file created by a Gradle build into a Maven repo in our Artifactory server.
It nearly all works, the only issue is that the pom file isn't being copied into the Artifactory repo.
The Gradle build includes the Gradle Maven plugin and running gradlew install locally results in both the jar and the pom inserted into the local Maven repo.
I've added a task in the Gradle build that generates the pom file in the same directory as the jar file and changed the Jenkins build to run that task too.
When the build has completed I can see both the jar and the pom file in the workspace.
Any ideas on what I need to do to get the pom file published along with the jar?
We're using:
Jenkins 2.10
Artifactory plugin 2.4.4
Gradle 2.14
The Gradle build file does not inlcude the Gradle Artifactory plugin.
Cheers, Andy
The Jenkins project is configured to use the Gradle-Artifactory integration (rather than the Generic-Artifactory integration).
As suggested by Dakota Brown I'm answering my own question, the solution to my problem was to un-tick the maven3 integration option. With that option unslected, everything works as expected.

could not find artifact while running maven build in 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.

Resources