maven version plugin NPE - maven

Hi I'm trying to execute
mvn versions:set -DgroupId=a304-b5c1d9177065 -DnewVersion=2.2.2
for my project with this pom.xml
project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>${groupId}</groupId>
<artifactId>mul-project-template-artifact</artifactId>
<version>1.0.0</version>
<packaging>mule-application</packaging>
<name>mul-project-template</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<app.runtime>4.3.0-20210119</app.runtime>
<mule.maven.plugin.version>3.4.2</mule.maven.plugin.version>
<groupId>com.company</groupId>
</properties>
mvn clean install
is working with build success
but
mvn versions:set -DgroupId=a304-b5c1d9177065 -DnewVersion=2.2.2
returns
ERROR] Failed to execute goal org.codehaus.mojo:versions-maven-plugin:2.1:set (default-cli) on project logger-connector-artifact: Execution default-cli of goal org.codehaus.mojo:versions-maven-plugin:2.1:set failed.: NullPointerException -> [Help 1]
Working with latest version also shows same exception
ERROR] Failed to execute goal org.codehaus.mojo:versions-maven-plugin:2.8.1:set (default-cli) on project logger-connector-artifact: Execution default-cli of goal org.codehaus.mojo:versions-maven-plugin:2.8.1:set failed.: NullPointerException -> –
I also have this warning
[WARNING] 'groupId' contains an expression but should be a constant. # ${groupId}:logger-connector-artifact:1.0.0, /home/jenkins/agent/workspace/ine_logger-connector_development/pom.xml, line 5, column 11 [WARNING] [WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.

Related

Missing artifact in pom.xml com.cardboardfish:http-sms:jar:1.0

<dependency>
<groupId>com.cardboardfish</groupId>
<artifactId>http-sms</artifactId>
<version>1.0</version>
</dependency>
i have the jar and already tried through maven command to install but its getting failled
mvn install:install-file -Dfile=cbfsms.jar
-DgroupId=com.cardboardfish
-DartifactId=http-sms -Dversion=1.0 -Dpackaging=jar
[INFO] Scanning for projects... [INFO]
------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO]
------------------------------------------------------------------------ [INFO] Total time: 0.125 s [INFO] Finished at:
2018-03-11T11:18:07+05:30 [INFO] Final Memory: 4M/116M [INFO]
------------------------------------------------------------------------ [ERROR] The goal you specified requires a project to execute but there
is no POM in this directory
(C:\Users\test\.m2\repository\com\cardboardfish\http-sms\1.0). Please
verify you invoked Maven from the correct directory. -> [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. [ERROR] [ERROR] For more information about
the errors and possible solutions, please read the following articles:
[ERROR] [Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/MissingProjectException
after a lot of task.. i found that due to pom.xml file missing it is giving the exception so, i have created a pom.xml for cbfsms.jar with following attribute
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.cardboardfish</groupId>
<artifactId>http-sms</artifactId>
<version>1.0</version>
<name>cardboard_fish_sbf_sms_jar</name>
<description>helpful jar for sms utilities</description>
<dependencies>
</dependencies>
</project>
than i used the Maven command and it worked for me
mvn install:install-file -Dfile=cbfsms.jar -DgroupId=com.cardboardfish
-DartifactId=http-sms -Dversion=1.0 -Dpackaging=jar
Due to an exception that you provided
The goal you specified requires a project to execute but there is no
POM in this directory
you run your maven commands in another directory that your pom.xml located. So go to where that your pom located and then run your desired maven commands.

Spring Boot - updated from 1.2.3.Release to 1.5.0.RELEASE

I updated following:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.3.RELEASE</version>
</parent>
to
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.0.RELEASE</version>
</parent>
and afterwards I started maven with:
mvn clean install -DskipTests
and I got this trace in the console, which mentions a non parsable POM:
[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-parseable POM
C:\Users\05906\.m2\repository\org\springframework\boot\spring-boot-
dependencies\1.5.0.RELEASE\spring-boot-dependencies-1.5.0.RELEASE.pom: in
epilog non whitespace content is not allowed but got r (position: END_TAG
seen ...</build>\n</project>r... #2606:12) #
C:\Users\05906\.m2\repository\org\springframework\boot\spring-boot-
dependencies\1.5.0.RELEASE\spring-boot-dependencies-1.5.0.RELEASE.pom, line
2606, column 12
#
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project com.smartinnotec.legalprojectmanagement:smartinnotec-
legalprojectmanagement-main:1.0.1-SNAPSHOT
(C:\Users\05906\Documents\workspace-sts-
survey\maven.1498452192342\smartinnotec-legalprojectmanagement-main\pom.xml)
has 1 error
[ERROR] Non-parseable POM
C:\Users\05906\.m2\repository\org\springframework\boot\spring-boot-
dependencies\1.5.0.RELEASE\spring-boot-dependencies-1.5.0.RELEASE.pom: in
epilog non whitespace content is not allowed but got r (position: END_TAG
seen ...</build>\n</project>r... #2606:12) #
C:\Users\05906\.m2\repository\org\springframework\boot\spring-boot-
dependencies\1.5.0.RELEASE\spring-boot-dependencies-1.5.0.RELEASE.pom, line
2606, column 12 -> [Help 2]
Does anyone know what I am doing wrong, the content in
C:\Users\05906\.m2\repository\org\springframework\boot\spring-boot-starter-parent\1.5.0.RELEASE
seems ok.
Please check end of your pom.xml file (spring-boot-dependencies-1.5.0.RELEASE.pom) on line 2606. It should only contain a </project>, but seems to have something starting with an 'r' after it.
If it is corrupted, you can easily fix it, by just removing it from the .m2 folder and letting Maven redownload it on the next build.
Other ways this issue could occur is if you have an old Maven version, and there is some construct in the pom.xml it does not yet now, but this is not the case for you.

Jenkins fails to parse POM with variables

tl;dr: mvn clean install works as expected, but Jenkins is not able to resolve variables in child poms.
We have a project with a main pom and multiple sub poms. It seems to fail in the sub pom with the variable ${project.version} not being resolved (see the error message below and scroll to its end).
Main pom:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>group</groupId>
<artifactId>artifact</artifactId>
<version>1.0.0.0-SNAPSHOT</version>
...
</project>
Sub pom:
<parent>
<groupId>group</groupId>
<artifactId>artifact</artifactId>
<version>${project.version}</version>
<relativePath>../pom.xml</relativePath>
</parent>
mvn clean install on the console works flawlessly:
[INFO] Installing /path/to/jenkins/workspace/Project/pom.xml to /path/to/.m2/repository/de/project/1.0.0.0-SNAPSHOT/project-1.0.0.0-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
...
[INFO] PROJECT 1.0.0.0-SNAPSHOT - EAR project ........... SUCCESS [ 5.038 s]
[INFO] PROJECT 1.0.0.0-SNAPSHOT - Aggregator project ........ SUCCESS [ 0.156 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:03 min
[INFO] Finished at: 2016-09-20T12:58:03+02:00
[INFO] Final Memory: 104M/1088M
[INFO] ------------------------------------------------------------------------
Jenkins fails to parse the pom and produces the following error:
Parsing POMs
ERROR: Failed to parse POMs
org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM: Failure to transfer my.package:project:pom:${project.version} from http://mynexus.com/content/groups/default was cached in the local repository, resolution will not be reattempted until the update interval of nexus-default has elapsed or updates are forced. Original error: Could not transfer artifact my.package:project:pom:${project.version} from/to nexus-default (http://mynexus.com/content/groups/default): Illegal character in path at index 78: http://mynexus.com/content/groups/default/my/package/project/${project.version}/panda-${project.version}.pom and 'parent.relativePath' points at wrong local POM # line 26, column 10
What has to be changed so that Jenkins can parse the pom file aswell?
The linked question states that maven would not be able to parse the child's properties as they wouldn't exist. The maven logs above show that this is not the case.
The information above is redacted. Typos are not the reason for this issue.
I fixed it by use Freestyle project Job instead of Maven project Job. Run native maven command in shell or locally didn't have this problem.
A similar error:
JENKINS-23846

how to build a war file using maven in eclipse for play framework2.5?

i am doing build war file using maven in eclipse for play 2.5.4 project
for that
it shows error like
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile (default-compile) on project play: Compilation failure
[ERROR] /C:/play/app/filters/ExampleFilter.java:[40,20] lambda expressions are not supported in -source 1.5
[ERROR] (use -source 8 or higher to enable lambda expressions)
[ERROR] -> [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.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
You're using or forcing JDK 5 but you need JDK 8 : http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
EDIT
To create WAR instead of JAR, add this to your pom :
<packaging>war</packaging>
Example :
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>hello-world</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
...
</project>

non resolvable parent POM issue

Hi i am having a strange issue building a maven project on a my machine.
Their does not seem to be an issue with the pom file or code as the exact same project can be succesfully built on another workstation.
the error i receive is this
The project com.jonney:jon-app-parent:1.3.9 (/Users/me/Work/jon-app-paren/pom.xml) has 1 error
[ERROR] Non-resolvable parent POM: Failure to find com.jonney-parent:pom:3 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced and 'parent.relativePath' points at wrong local POM # line 6, column 13 -> [Help 2]
[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.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException
here is a snippet of my pom file
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>com.jonney-parent</artifactId>
<name>Jon SDK java</name>
<packaging>jar</packaging>
<parent>
<groupId>com.jonney</groupId>
<artifactId>com.jonney-parent</artifactId>
<version>1.3.9</version>
<relativePath>../pom.xml</relativePath>
</parent>
Try calling Maven with "-U" option (force update of dependencies).

Resources