Maven Release Plugin throws svn : '' is not a working copy - jenkins

I have a mavenized project and when I try to do a release, I get the below error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.4
.2:prepare (default-cli) on project SimpleWeb: Unable to check for local modific
ations
[ERROR] Provider message:
[ERROR] SVN status failed.
[ERROR] Command output:
[ERROR] svn: '' is not a working copy
I have the below questions:
How is the scm configuration is given in POM file
If the communication to scm should happen through https, how can we configure the certificate on the client side
The release should happen from branch or trunk
My scm configuration is as follows:
<scm>
<connection>scm:svn:https://domain.com/svn/New_FW/CI_POC/SimpleWeb/trunk</connection>
<developerConnection>scm:svn:https://domain.com/svn/New_FW/CI_POC/SimpleWeb/trunk</developerConnection>
<url>https://domain.com/svn/New_FW/CI_POC/SimpleWeb/trunk</url>
</scm>
My maven release plugin configuration is as follows:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-scm-plugin</artifactId>
<version>1.3</version>
<configuration>
<providerImplementations>
<svn>javasvn</svn>
</providerImplementations>
<username>${scm.username}</username>
<password>${scm.password}</password>
</configuration>
<dependencies>
<dependency>
<groupId>com.google.code.maven-scm-provider-svnjava</groupId>
<artifactId>maven-scm-provider-svnjava</artifactId>
<version>1.14</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.4.2</version>
<dependencies>
<dependency>
<groupId>com.google.code.maven-scm-provider-svnjava</groupId>
<artifactId>maven-scm-provider-svnjava</artifactId>
<version>1.6</version>
</dependency>
</dependencies>
<configuration>
<providerImplementations>
<svn>javasvn</svn>
</providerImplementations>
<tagBase>https://domain-inc.com/svn/New_FW/CI_POC/SimpleWeb/tags</tagBase>
<mavenExecutorId>forked-path</mavenExecutorId>
</configuration>
</plugin>
I am struck here and cant move ahead. Please help/guide me in resolving the issue. When I run the same by configuring the Maven Release Plugin in Jenkins I get a different error as: "svn: Authentication required". Why is this difference.

On Windows Jenkins slave I have same issue with multi maven project.
For fix it I added:
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
...
<configuration>
<commitByProject>true</commitByProject>
...
</configuration>
...

Related

Failed to read artifact descriptor for org.apache.maven.plugins:maven-source-plugin:jar:2.4

Thanks to a Dropwizard Maven archetype I generated a sample Dropwizard Maven project. The pom.xml notably uses maven-source-plugin:
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
When I run "clean install" I have the following error :
Plugin org.apache.maven.plugins:maven-source-plugin:2.4 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-source-plugin:jar:2.4: Could not transfer artifact org.apache.maven.plugins:maven-source-plugin:pom:2.4 from/to central (http://repo.maven.apache.org/maven2): Connection refused: connect -> [Help 1]
The "maven-source-plugin" dependency is stored in the Nexus repository of my company. So I tried the adding of the plugin dependency between dependencies and /dependencies :
<dependencies>
...
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.4</version>
</dependency>
</dependencies>
but it did not correct the problem. I also tried to add the dependency at the call of the plugin :
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.4</version>
</dependency>
</dependencies>
</plugin>
but it did not work either
Two possible situations :
Your company uses a proxy to connect to the public Maven repository. Then ask someone in your company what the IP address of the proxy is then put it in your settings.xml file
Your company has its/their own Maven repository/ies (Nexus repository for example). Then ask someone in your company what the Nexus repository is then put it in your pom.xml or in your settings.xml. See Adding maven nexus repo to my pom.xml and https://maven.apache.org/guides/mini/guide-multiple-repositories.html
It may happen, e.g. after an interrupted download, that Maven cached a broken version of the referenced package in your local repository.
Solution: Manually delete the folder of this plugin from cache (i.e. your local repository), and repeat maven install.
How to find the right folder? Folders in Maven repository follow the structure:
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.4</version>
</dependency>
is cached in ${USER_HOME}\.m2\repository\org\apache\maven\plugins\maven-source-plugin\2.4
Update the apache-maven-3.5.0-bin\apache-maven-3.5.0\conf\settings.xml file.
Check your internet explorer proxy --> Setting --> Internet explorer -->Connection --> LAN Setting
<proxy>
<id>optional</id>
<active>true</active>
<protocol>http</protocol>
<username>user</username>
<password>****</password>
<host>proxy</host>
<port>8080</port>
</proxy>
I am using JDK 7 for maven project and I used -Dhttps.protocols=TLSv1.2 as argument in JRE. It has allowed to download all maven repository which were failing earlier.
org.apache.maven.plugins:maven-source-plugin does not exist in the repository http://repo.maven.apache.org/maven2.
You have to download it from Maven central where it exists => maven-source-plugin
Verify your pom definition or your settings.xml file.
so I am assuming that this project you are doing in your private eclipse (not company provided eclipse where you work). The same problem I resolved just as below
quick fix : got to .m2 file --> create a backup of settings.xml --> remove settings.xml --> restart your eclipse.
On my side it was coming from an error in my settings.xml file.
I had a bad tag. Just removed it, refreshed and i was good to go.
Remove the content of the folder \.m2\repository\org\apache\maven\plugins\maven-resource-plugin\2.7. The cached info turned out to be the issue.
I use intelliJ and finally I created my own settings.xml and added the following content structure to it. In my project's pom.xml, the nexus repositories were defined but for some reason it was always hitting the external apache maven repo which is blocked in my company.
<settings>
<mirrors>
<id>nexus</id>
<url>nexusURL </url>
<mirrorOf>central</mirrorOf>
<mirror>
<profiles>
<profile>
<repositories>
<repository>
</settings>

How to point CARGO to Jar files to deploy on JBoss 7.*?

This is the console output from Jenkins when I attempt to deploy my application:
Caused by: org.codehaus.cargo.util.CargoException: Cannot locate the JBoss connector classes! Make sure the required JBoss JARs (or Maven dependencies) are in CARGO's classpath.
More information on: http://cargo.codehaus.org/JBoss+Remote+Deployer
at org.codehaus.cargo.container.jboss.JBoss5xRemoteDeployer.<init> (JBoss5xRemoteDeployer.java:161)
at org.codehaus.cargo.container.jboss.JBoss7xRemoteDeployer.<init>(JBoss7xRemoteDeployer.java:41)
... 26 more
Caused by: java.lang.ClassNotFoundException: org.jboss.as.controller.client.ModelControllerClient
at jenkins.util.AntClassLoader.findClassInComponents(AntClassLoader.java:1376)
at jenkins.util.AntClassLoader.findClass(AntClassLoader.java:1326)
at jenkins.util.AntClassLoader.loadClass(AntClassLoader.java:1079)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at org.codehaus.cargo.container.jboss.JBoss5xRemoteDeployer.<init>(JBoss5xRemoteDeployer.java:156)
... 27 more
Build step 'Deploy war/ear to a container' marked build as failure
Finished: FAILURE
This is the content regarding CARGO in my POM file.
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.2.0</version>
<configuration>
<container>
<containerId>jboss7x</containerId>
<type>remote</type>
</container>
</configuration>
<executions>
<execution>
<id>deploy</id>
<phase>install</phase>
<goals>
<goal>redeploy</goal>
</goals>
<configuration>
<type>runtime</type>
<properties>
<cargo.hostname>localhost</cargo.hostname>
<cargo.jboss.management.port>19999</cargo.jboss.management.port>
</properties>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-controller-client</artifactId>
<version>7.1.1.Final</version>
</dependency>
</dependencies>
</plugin>
I've tried all the other solutions I've found online and none of them do the trick. Any ideas?
I solved this issue by copying all jar files from JBoss modules folder into the jenkins/plugins/deploy/WEB-INF.
It seems that your classloader cannot find jboss-as-controller-client, even if it is defined as plugin dependency.
You may try to define jboss-as-controller-client as project dependency. If the problem will still persist then try to add jboss-as-controller-client jar into classpath of java which is used.

Jenkins : Run Multiple Dependencies Maven Project

I have 3 maven projects. Project1, Project2 & Project3.
Project3 depends on Project1 & Project2 and Project2 depends on Project1.
For this I have added this in Project2 pom.xml file
<modelVersion>4.0.0</modelVersion>
<groupId>Project2</groupId>
<artifactId>Project2</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>Project1</groupId>
<artifactId>Project1</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
My pom.xml for Project3 is -
<modelVersion>4.0.0</modelVersion>
<groupId>Project3</groupId>
<artifactId>Project3</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>Project1</groupId>
<artifactId>Project1</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>Project2</groupId>
<artifactId>Project2</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
In the project 3 I have added testng.xml file to run the test. Now If I run this testng.xml file then all my test cases are running successfully.
I have included testng.xml file in the pom file below dependencies to run testng test using maven -
<build>
<!-- Source directory configuration -->
<sourceDirectory>src</sourceDirectory>
<plugins>
<!-- Following plugin executes the testng tests -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.14.1</version>
<configuration>
<!-- Suite testng xml file to consider for test execution -->
<suiteXmlFiles>
<suiteXmlFile>Tng1.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
<!-- Compiler plugin configures the java version to be used for compiling the code -->
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
Even these tests are running when I am trying to run this using Maven Test. But when I tried to run this using jenkins then it fails and shows below error.
[WARNING] The POM for Project1:Project1:jar:0.0.1-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for Project2:Project2:jar:0.0.1-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.476 s
[INFO] Finished at: 2015-08-25T15:16:56+05:30
[INFO] Final Memory: 13M/114M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project Project3: Could not resolve dependencies for project Project3:Project3:jar:0.0.1-SNAPSHOT: The following artifacts could not be resolved: Project1:Project1:jar:0.0.1-SNAPSHOT, Project2:Project2:jar:0.0.1-SNAPSHOT: Could not find artifact Project1:Project1:jar:0.0.1-SNAPSHOT -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
Please Help !!!

Jenkins Post Build Action: Deploy war to JBoss AS 7.x

I have Googled the following issue but not quite got what exactly to do as I am new to Jenkins. Here is one solution to this on SO itself, I can't comment on answer, due to low reputation.
How to deploy war file to jboss 7.1.1 from jenkins1.573 automatically during build?
It would be really great if somebody provides step by step way out of this:
Caused by: org.codehaus.cargo.util.CargoException: Cannot locate the JBoss connector classes! Make sure the required JBoss JARs (or Maven dependencies) are in CARGO's classpath.
More information on: http://cargo.codehaus.org/JBoss+Remote+Deployer
Edit Updated Pom.xml
<build>
<sourceDirectory>src</sourceDirectory>
<testSourceDirectory>test</testSourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.jboss.as.plugins</groupId>
<artifactId>jboss-as-maven-plugin</artifactId>
<version>7.4.Final</version>
</plugin>
</plugins>
</build>
If you use maven you can use maven jboss as plugin. Just add
<pluginManagement>
<plugins>
<plugin>
<groupId>org.jboss.as.plugins</groupId>
<artifactId>jboss-as-maven-plugin</artifactId>
<version>7.4.Final</version>
</plugin>
<plugins>
</pluginManagement>
to your project's pom.xml
Then add as post-build step:
cd my-ear-or-war-packaged-project
mvn jboss-as:deploy -Djboss-as.port=9999 -Djboss-as.hostname=localhost
and the code should deploy in the post build step.
You can also add the execution of the plugin to a dedicated maven profile, which would make the artifact deploy already during the build phase, without the need to create additional build step in jenkins.

maven-glassfish-plugin in maven-3.0.4

Upon running mvn install glassfish:deploy I run into the following problems
[...]
[ERROR] Failed to execute goal org.glassfish.maven.plugin:maven-glassfish-plugin:2.1:deploy (default-cli) on project post-build-pom: Execution default-cli of goal org.glassfish.maven.plugin:maven-glassfish-plugin:2.1:deploy failed: Plugin o rg.glassfish.maven.plugin:maven-glassfish-plugin:2.1 or one of its dependencies could not be resolved: Failed to collect dependencies for org.glassfish.maven.plugin:maven-glassfish-plugin:jar:2.1 (): Failed to read artifact descriptor for org.apache.maven:maven-plugin-api:jar:3.0-SONATYPE-688946: Failure to find org.apache.maven:maven-parent:pom:9-SNAPSHOT in http://maven-repository/content/groups/public was cached in the local repository, resolution will not be reattempted until the update interval of internal-repository has elapsed or updates are forced -> [Help 1]
[...]
My mvn -v looks like this:
Apache Maven 3.0.4 (r1232337; 2012-01-17 09:44:56+0100)
Maven home: C:\Users\rob\apache-maven-3.0.4\bin\..
Java version: 1.6.0_37, vendor: Sun Microsystems Inc.
Java home: C:\Programme\Java\jdk1.6.0_37\jre
Default locale: de_DE, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
Futhermore my nexus-repository runs on http://maven-repository .
EDIT: The plugin-part from pom.xml looks like this:
<plugin>
<groupId>org.glassfish.maven.plugin</groupId>
<artifactId>maven-glassfish-plugin</artifactId>
<version>2.1</version>
<configuration>
<user>admin</user>
<adminPassword>adminadmin</adminPassword>
<glassfishDirectory>c:\development\glassfish-v2.1.1-b31g</glassfishDirectory>
</configuration>
</plugin>
you're not the only one facing problems there :)
there seems to be even official bug report for that: http://java.net/jira/browse/GLASSFISH-14411
As a workaround suggested here: http://jira.codehaus.org/browse/MNG-4843
you should override the plugin dependencies in your project with proper versions.
Following should solve your problem:
<build>
<plugins>
<plugin>
<groupId>org.glassfish.maven.plugin</groupId>
<artifactId>maven-glassfish-plugin</artifactId>
<version>2.1</version>
<configuration>
<user>admin</user>
<adminPassword>adminadmin</adminPassword>
<glassfishDirectory>c:\development\glassfish-v2.1.1-b31g</glassfishDirectory>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-project</artifactId>
<version>3.0-alpha-2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>3.0.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
<version>3.0.4</version>
<scope>provided</scope>
</dependency>
</dependencies>
Of course you need to provide all the configuration required, but it's another topic covered by: http://maven-glassfish-plugin.java.net/examples/complete.html
I find another way to solve this:
copy file "C:\Users\< current user >\.m2\repository\org\apache\maven\maven-parent\11\maven-parent-11.pom"
to
"C:\Users\< current user >\.m2\repository\org\apache\maven\maven-parent\11-SNAPSHOT\"
and rename it to "maven-parent-11-SNAPSHOT.pom"

Resources