pom.xml build failure for https dependencies in Jenkins - jenkins

I am creating a jenkins job for running my testng code.When the pom.xml is building,all other dependencies are complied properly but the one having https reporsitory is blocked.Due to this i am unable to start chrome driver through webdriver manager too.
maven dependency :
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-email</artifactId>
<version>20.3</version>
<classifier>jdk16</classifier>
</dependency>
the exception is as follows
Failed to collect dependencies at com.aspose:aspose-email:jar:jdk16:20.3: Failed to read artifact descriptor for com.aspose:aspose-email:jar:jdk16:20.3: Could not transfer artifact com.aspose:aspose-email:pom:20.3 from/to maven-default-http-blocker (http://0.0.0.0/): Blocked mirror for repositories: [AsposeJavaAPI (http://repository.aspose.com/repo/, default, releases+snapshots)] -> [Help 1]
P.S : this code works fine in eclipse

Related

Jenkins Build Failure, Cobertura Error

I tried to build a job and it returns following error:
> Failed to execute goal
> org.codehaus.mojo:cobertura-maven-plugin:2.7:instrument (default-cli)
> on project addressbook: Execution default-cli of goal
> org.codehaus.mojo:cobertura-maven-plugin:2.7:instrument failed: Plugin
> org.codehaus.mojo:cobertura-maven-plugin:2.7 or one of its
> dependencies could not be resolved: Could not find artifact
> com.sun:tools:jar:0 at specified path
> /var/lib/jenkins/tools/hudson.model.JDK/myjava/../lib/tools.jar ->
> [Help 1]
Any idea how to resolve it?
I guess the jdk in question was above 8 which is still not supported by Cobertura: https://github.com/mojohaus/cobertura-maven-plugin/issues/30
[ERROR] Failed to execute goal
org.codehaus.mojo:cobertura-maven-plugin:2.7:instrument (verification)
on project generex: Execution verification of goal
org.codehaus.mojo:cobertura-maven-plugin:2.7:instrument failed: Plugin
org.codehaus.mojo:cobertura-maven-plugin:2.7 or one of its
dependencies could not be resolved: Could not find artifact
com.sun:tools:jar:0 at specified path
/usr/local/lib/jvm/openjdk11/../lib/tools.jar
I had to switch to https://www.jacoco.org/jacoco/ instead.
Seems like you are missing the tools jar in your JDK/JRE library you can confirm it by searching for the JAR in the lib folder if it's not present then you can add the following in your pom.xml
<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>1.6.0</version>
<scope>system</scope>
<systemPath>${env.JAVA_HOME}/lib/tools.jar</systemPath>
</dependency>
Where ${env.JAVA_HOME} points to the JAVA you set in environment variables if you are using another JRE apart from the one set then specify the path like so /var/lib/jenkins/tools/hudson.model.JDK/myjava/JDK8/lib/lib
Hope it helps :)

How do I resolve java.lang.NoSuchMethodError: com.google.api.services.dataflow.model.Environment.setSdkPipelineOptions with Google Cloud Dataflow?

I copied the MinimalWordCount example.
I also copied all the dependencies from pom.xml. When I run it with
mvn compile exec:java -Dexec.mainClass=com.example.MyExample
it compiles, but I get java.lang.NoSuchMethodError: com.google.api.services.dataflow.model.Environment.setSdkPipelineOptions with the stacktrace pointing to the p.run() line.
In addition to the dependencies, you need to add the Google Cloud Dataflow parent pom.
<parent>
<groupId>com.google.cloud.dataflow</groupId>
<artifactId>google-cloud-dataflow-java-sdk-parent</artifactId>
<version>1.6.0</version>
</parent>

Jenkins Failed Inspecting Plugin during development

I'm trying to develop a new Jenkins plugin that has a jar dependency to something from my Nexus repo.
When I try to launch the plugin in a debug mode to attach my IDE
mvnDebug hpi:run
I get the following error message:
Apr 25, 2016 11:04:37 AM jenkins.InitReactorRunner$1 onTaskFailed
SEVERE: Failed Inspecting plugin C:\dev\Eclipse\vsync\work\plugins\vsync.hpl
java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:230)
at java.util.zip.ZipFile.<init>(ZipFile.java:160)
at java.util.jar.JarFile.<init>(JarFile.java:168)
at java.util.jar.JarFile.<init>(JarFile.java:132)
at jenkins.util.AntClassLoader.addPathFile(AntClassLoader.java:502)
at hudson.ClassicPluginStrategy$AntClassLoader2.addPathFiles(ClassicPluginStrategy.java:768)
at hudson.ClassicPluginStrategy.createClassLoader(ClassicPluginStrategy.java:278)
at hudson.ClassicPluginStrategy.createPluginWrapper(ClassicPluginStrategy.java:253)
at hudson.PluginManager$1$3$1.run(PluginManager.java:254)
at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:169)
at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:282)
at jenkins.model.Jenkins$7.runTask(Jenkins.java:905)
at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:210)
at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1176)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:795)
I've checked my vsync.hpl file and see that it was properly generated, but the Libraries list is quite long due to all the dependencies that my jar has pulled in with it.
I suspect that Jenkins is failing trying to access/open one of those dependencies, but I have no idea which one it is. Is there a way to get additional debug information out, to know which jar/zip file is failing?
Or baring that, is there a way I can put Jenkins itself (ie the Jetty container) in a debug mode and attach a debugger to that so I can step through the plugin load process and see what is failing?
I have encountered the same Exception and in my case, it was caused by having a pom dependency in pom.xml, like below:
<dependency>
<groupId>org.jenkins-ci.main</groupId>
<artifactId>cli</artifactId>
<version>1.596.1</version>
<type>pom</type>
</dependency>
Which cause Jenkins try to extract pom file, which fails.

Access denied error when deploying artifact to Archiva remote repo

I am trying to deploy project artifact into Archiva remote repository but keeps getting this error:
Error Message:
[INFO] --- maven-deploy-plugin:2.8.1:deploy (default-deploy) # mavenandroidapplication ---
Downloading: http://192.168.10.29:8080/archiva/repository/snapshots/com/stm/idg/android/mavenandroidapplication/1.0-SNAPSHOT/maven-metadata.xml
Uploading: http://192.168.10.29:8080/archiva/repository/snapshots/com/stm/idg/android/mavenandroidapplication/1.0-SNAPSHOT/mavenandroidapplication-1.0-20131105.013101-1.apk
Uploading: http://192.168.10.29:8080/archiva/repository/snapshots/com/stm/idg/android/mavenandroidapplication/1.0-SNAPSHOT/mavenandroidapplication-1.0-20131105.013101-1.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.707s
[INFO] Finished at: Tue Nov 05 09:31:01 SGT 2013
[INFO] Final Memory: 16M/39M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.1:deploy (default-deploy) on project mavenandroidapplication: Failed to deploy artifacts: Could not transfer artifact com.stm.idg.android:mavenandroidapplication:apk:1.0-20131105.013101-1 from/to archiva.snapshots (http://192.168.10.29:8080/archiva/repository/snapshots/): Access denied to http://192.168.10.29:8080/archiva/repository/snapshots/com/stm/idg/android/mavenandroidapplication/1.0-SNAPSHOT/mavenandroidapplication-1.0-20131105.013101-1.apk. Error code 401, Unauthorized -> [Help 1]
I am using Maven 3.0.5, Archiva 1.3.6, Android Development Kit. This is a maven project and I execute via Run As --> Maven build --> (Goals) deploy.
Below are the configurations:
Settings.xml
Note:
<server>
<id>archiva.internal</id>
<username>admin</username>
<password>123</password>
</server>
<server>
<id>archiva.snapshots</id>
<username>admin</username>
<password>123</password>
</server>
Pom.xml
<distributionManagement>
<repository>
<id>archiva.internal</id>
<name>Internal Release Repository</name>
<url>http://192.168.10.29:8080/archiva/repository/internal/</url>
</repository>
<snapshotRepository>
<id>archiva.snapshots</id>
<name>Internal Snapshot Repository</name>
<url>http://192.168.10.29:8080/archiva/repository/snapshots/</url>
</snapshotRepository>
</distributionManagement>
Really appreciate your help. Thank you.
A few suggestions:
1.) Ensure that you have all your servers listed in your Maven settings.xml. This gets me sometimes.
2.) Ensure that your snapshot repo id matches the repo id defined within Archiva.
3.) Ensure that you have access to the snapshots repo, even as admin. Permissions can be revoked.
4.) Ensure that you have the right password.
5.) I've had a restart of Archiva fix this problem before.
6.) And, finally, ensure that you have the following settings.xml config in place. This solution doesn't quite fit your scenario, but it's good to list nonetheless. The following config will allow you to deploy snapshots to a custom snapshots repo that's part of a repository group (i.e. - a snapshots repo for a particular team):
<mirror>
<id><repo_group_id></id>
<mirrorOf>*, !<team_snapshot_repo_id></mirrorOf>
<name>My Team's Maven Repository</name>
<url>http://<HOST>:<PORT>/archiva/repository/<repo_group_id>/</url>
</mirror>

Grails Release plugin is not deploying plugin on a remote maven repository

I'm having problems to deploy a plugin with the command maven-deploy on a remote repo.
I installed the latest version of the Release plugin (2.0.2).
I get this error:
| Loading Grails 2.0.4
| Configuring classpath.
| Environment set to development.....
| Packaging Grails application.....
| Compiling 33 GSP files for package [myPackage].....
| Plugin packaged grails-plugin-myPlugin.jar
| Skipping POM generation because 'pom.xml' exists in the root of the project..
| Error Error executing script MavenDeploy: : Error downloading wagon provider from the remote repository: Missing:
----------
1) org.apache.maven.wagon:wagon-http:jar:1.0-beta-2
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=org.apache.maven.wagon -DartifactId=wagon-http -Dversion=1.0-beta-2 -Dpackaging=jar -Dfile=/path/to/file
Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=org.apache.maven.wagon -DartifactId=wagon-http -Dversion=1.0-beta-2 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
Path to dependency:
1) unspecified:unspecified:jar:0.0
2) org.apache.maven.wagon:wagon-http:jar:1.0-beta-2
----------
1 required artifact is missing.
for artifact:
unspecified:unspecified:jar:0.0
from the specified remote repositories:
central (http://repo1.maven.org/maven2)
(Use --stacktrace to see the full trace)
Thanks for your help
I had the same problem and could handle it this way:
Install Maven2
Configure proxy as described here
This is enough to solve your problem.
If your maven server requires authentication you can proceed as described here or here
~/.m2/settings.xml:
<settings>
<proxies>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>proxyserver.mydomain.com</host>
<port>8080</port>
<username>user</username>
<password>pass</password>
<nonProxyHosts>*.bla.com.br|*.blabla.biz</nonProxyHosts>
</proxy>
</proxies>
<servers>
<server>
<id>myrepo</id>
<username>user</username>
<password>pass</password>
</server>
</servers>
</settings>
This looks like a Maven issue:
Maven fails to download a required dependency
org.apache.maven.wagon:wagon-http:jar:1.0-beta-2 from
http://repo1.maven.org/maven2
Since the required artifact can be found in Maven central this may be a result of a networking issue
I found a workaround for this issue. Since something tries to retrieve wagon-http dependency using deprecated http maven repository url, we can manually preinstall this dependency in our local repository:
mvn org.apache.maven.plugins:maven-dependency-plugin:2.1:get -Dartifact=org.apache.maven.wagon:wagon-http:1.0-beta-2 -Dpackaging=jar -DrepoUrl=https://repo1.maven.org/maven2
After that publish-plugin command should work.
Possible fix for that issue would be upgrade grails-release plugin to v3.1.3(didn't work for me): link

Resources