How to release Maven project using Jenkins - maven

When I am trying to release a Maven project using Jenkins, I am getting an error like this:
Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5:prepare (default-cli) on project maven-plugin: You don't have a SNAPSHOT project in the reactor projects list.

The error message means that the project (or one of its submodules) is not a SNAPSHOT project, i.e. it's version is not [version]-SNAPSHOT but only [version].
You cannot release a project that is not a SNAPSHOT project so you need to change the version of your pom.xml to include -SNAPSHOT.

Related

Can't release project due to non-released dependencies in Pipeline

I am building a project in a pipeline. I am getting Build Failure Error: Can't release the project due to non-released dependencies.
Multi-module java project using Maven as the Build tool and Nexus as repository manager in Jenkins pipeline.
When the artifact named as -SNAPSHOT, I was able to build a snapshot, generate war file, upload it to Nexus but during the next cycle in the Build phase, it fails with the error: Can't release the project due to non-released dependencies. I don't have any control over the scripts/steps in the pipeline.

Teamcity Issue :Unable to add module to the current project as it is not of packaging type 'pom'

I am trying to add Maven build step in TeamCity to generate Maven archetype.
mvn archetype:generate
This works fine in command prompt.
Unfortunately it throws below error in TeamCity:
Failed to execute goal
org.apache.maven.plugins:maven-archetype-plugin:3.0.1:generate
(default-cli) on project pso-jms-listener-archetype:
org.apache.maven.archetype.exception.InvalidPackaging: Unable to add
module to the current project as it is not of packaging type 'pom'
I created a new folder and tried executing it there, but still throws the same error
Any suggestions would help.
You may already have a POM file in the directory where mvn archetype:generate is executed.
For Maven, archetype is
a Maven project templating toolkit. An archetype is defined as an
original pattern or model from which all other things of the same kind
are made.
In short, you are creating a project (from a template) in an other project.
In your project folder, delete the file pom.xml and use mvn archetype:generate again.

Could not find the selected project in the reactor Maven : Jenkins

I’m using Jenkins to build a multi-module Maven project. Recently, I removed a module from our parent pom
when we run the build in Jenkins with the following options …
mvn -T 8C clean install -PTata
However, the build ultimately fails with the below error.
“Could not find the selected project in the reactor: com.customization:Avg”
Project Structure
- src
Customization
Tata
Avg
Qlip
Suggest to solve this issue...

jbpm maven build failing

I have cloned one jbpm git repository in eclipse and imported the project.
When i convert the same to a maven project, build is failing
Error
Description Resource Path Location Type
Project build error: Unresolveable build extension: Plugin org.kie:kie-maven-plugin:6.1.0.Final or one of its dependencies could not be resolved: Failed to collect dependencies for org.kie:kie-maven-plugin:jar:6.1.0.Final () pom.xml /jBpmLearn line 1 Maven pom Loading Problem
How to resolve this issue
Not sure which project you are cloning or why it's failing exactly, but have you added the JBoss Nexus maven repo so it knows where to find all the jBPM artefacts, like:
https://github.com/droolsjbpm/jbpm/blob/master/pom.xml#L50

SonarQube scan failing with "is already part of project XXX error is already part of project"

Recently I upgraded sonarqube from 4.0 to 4.3.3. Post upgrade when I try to run the maven build I am getting the error:
Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.4:sonar (default-cli) on project xxx on project yyy Module "abc.def.xyz" is already part of project of other project.
The issue is we scan on multiple branches so we will have modules with the same name.
Is there a way to turn off this validation?
Assume you have multiple modules Maven project with below structure:
com.company:project
com.company:project-module1
com.company:project-module2
In your java source code, now "com.company:project" renamed to "com.company:myProject", so new java source strucutre becomes:
com.company:myProject
com.company:project-module1
com.company:project-module2
When you build new source and push analysis data to Sonar, it prompt:
[ERROR] Failed to execute goal
org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar
(default-cli) on project myProject: Module
"com.company:project-module1" is already part of project
"com.company:project" -> [Help 1]
This error is because the "com.company:project-module1" already executed and registered into Sonar before and now it belongs to "com.company:project" project whihc no longer exist in your source code anymore.
Solution:
In Sonar project configuration --> Update key, change the project "com.company:project" key from "com.company:project" to "com.company:myProject", rerun Maven build and push to Sonar, issue will solve.

Resources