Maven NullPointer Exceptions - maven

I am integrating Soapui with jenkins using soapui version 5.3.0.
I am using correct plugins, and created a job on Jenkins, when running job on jenkins getting below error
ERROR: Processing failed due to a bug in the code. Please report this to the issue tracker (https://jenkins.io/redirect/report-an-issue).
java.lang.NullPointerException
project=hudson.maven.MavenModuleSet#1844c02b[Integration-/Feature/Dev/API/Testing1]
project.getModules()=[hudson.maven.MavenModule#2e2290bb[Integration-/Feature/Dev/API /Testing1/Test:gorun-Beakon][Integration-/Feature/Dev/API/Testing1/Test:gorun][relativePath:], hudson.maven.MavenModule#427c50e9[Integration-/Feature/Dev/API/Testing1/Test:Test][Integration-/Feature/Dev/API/Testing1/Test:Test][relativePath:], hudson.maven.MavenModule#73de5944[relativePath:], hudson.maven.MavenModule#1c7bb084[Integration-/Feature/Dev/API/Testing1/com.smartbear.soapui:soapui-project][Integration-/Feature/Dev/API/Testing1/com.smartbear.soapui:soapui-project][relativePath:], hudson.maven.MavenModule#71ee9349[Integration-/Feature/Dev/API/Testing1/tdrury:com.example.soapuitests][Integration-/Feature/Dev/API/Testing1/tdrury:com.example.soapuitests][relativePath:]]
project.getRootModule()=hudson.maven.MavenModule#2e2290bb[Integration-/Feature/Dev/API/Testing1/Test:gorun][Integration-/Feature/Dev/API/Testing1/Test:gorun][relativePath:]
FATAL: null
java.lang.NullPointerException
Posting build status of FAILED to SWC Bitbucket for commit id [30fd540296aa2f090025d21cf11eef35e13e9f5d] and ref 'refs/heads/master'
Failed to post build status, additional information: timeout
Finished: FAILURE
here is my 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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.smartbear.samples</groupId>
<artifactId>soapui-maven2-plugin</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>Maven 2 SoapUI Sample</name>
<url>http://maven.apache.org</url>
<pluginRepositories>
<pluginRepository>
<id>SmartBearPluginRepository</id>
<url>http://www.soapui.org/repository/maven2/</url>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<plugin>
<groupId>com.smartbear.soapui</groupId>
<artifactId>soapui-pro-maven-plugin</artifactId>
<version>5.3.0</version>
<dependencies>
</dependencies>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<projectFile>gorun.xml</projectFile>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
I am tried changing my pom and other properties but not sure why i am hitting this error.

This issue was coming because few dependencies were missing and maven was not complaining explicitly. So when run as normal maven project, got all missing dependencies and added them resolved this issue.
Thanks!!!

Related

No SCM URL was provided to perform the release from

I am trying to use maven release plugin and after that automate this using nexus.
Here is my 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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.ozge.net</groupId>
<artifactId>com.ozge.net</artifactId>
<version>1.1- snapshot</version>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<tagBase>svn://local/exekuce/com.ozge.net</tagBase>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<scm>
<tag>HEAD</tag>
<connection>scm:svn:svn://[svnusername]:[svn password]#local/exekuce/com.ozge.net</connection>
<developerConnection>scm:svn:svn://[svnusername]:[svn password]#local/exekuce/com.ozge.net</developerConnection>
<url>scm:svn:svn://[svnusername]:[svn password]#local/exekuce/com.ozge.net</url>
</scm>
<distributionManagement>
<repository>
<id>OzgeRelease</id>
<url>http://localhost:8081/nexus/content/repositories/OzgeRelease</url>
</repository>
</distributionManagement>
</project>
after I ran the command mvn release:perform on command prompt
it says
No SCM URL was provided to perform the release from
I believe I provided.
Anybody here tried to maven-subversion-nexus-hudson for automating builds?
Try to perform release:clean first.
mvn release:clean
Then try again.

copy jars used by plugin to single folder using Maven

In my POM.xml other the plugin configuration, i am not required to configure any dependenices to run the plugin. I would like to download dependent jars used by plugin(soapui-maven-plugin) from the repository into one single folder. I tried the command "mvn dependency:copy-dependencies", but no jars are copied. Is there any way to do it?
<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>service.report</groupId>
<artifactId>service-report</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>Maven 2 SoapUI Sample</name>
<build>
<plugins>
<plugin>
<groupId>com.smartbear.soapui</groupId>
<artifactId>soapui-maven-plugin</artifactId>
<version>5.0.0</version>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>loadtest</goal>
</goals>
<configuration>
<projectFile>${basedir}/src/main/resources/xxxxx-soapui-project.xml</projectFile>
<testSuite>xxxx</testSuite>
<testCase>sssss</testCase>
<loadTest>LoadTest 1</loadTest>
<outputFolder>${basedir}/target/surefire</outputFolder>
<junitReport>true</junitReport>
<exportAll>true</exportAll>
<printReport>true</printReport>
<testFailIgnore>false</testFailIgnore>
<!-- <projectProperties>
<value>message=Hello World!</value>
</projectProperties> -->
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
mvn dependency:copy-dependencies is only applied to current maven module only. It won't works on plugins. If you want to download all soapui-maven-plugin dependencies, you need to execute command from soapui-maven-plugin project. You can follow the following steps. I assumed you familiar with GIT CLI. If not, you need to manually download from https://github.com/SmartBear/soapui
git clone https://github.com/SmartBear/soapui
cd soapui/soapui-maven-plugin
mvn dependency:copy-dependencies
You can get list of dependencies in soapui/soapui-maven-plugin/target/dependency (total 82files)
[ERROR] Failed to execute goal on project soapui-maven-plugin: Could not resolve dependencies for project com.smartbear.soapui:soapui-maven-plugin:maven-plugin:5.0.0: Could not find artifact javafx:jfxrt:jar:2.2 at specified path (your jdk path)
If you get the above error, it means your maven jdk is version jdk.1.7 (u6 or earlier) which is not installed with javafx. Download newer jdk that comes with javafx at http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html . Remember change your maven jdk to this newer jdk.
If you want to use the dependency-plugin you could add the dependencies to the pom...and download with the depepndency-plugin...
It works right for me...
<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.ab.forge.utility.copydependenciespom</groupId>
<artifactId>copydependenciespom</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<!-- BINARIES -->
<dependencies>
<!--CUSTOMER RETURN -->
<dependency>
<groupId>com.ab...</groupId>
<artifactId>customerret.....</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<overWriteIfNewer>true</overWriteIfNewer>
<overWriteReleases>true</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
<excludeGroupIds>com.ab.ah.scad.acl</excludeGroupIds>
<excludeTypes>pom</excludeTypes>
<includeGroupIds>com.ab.oneleo</includeGroupIds>
<outputDirectory>${outputDirectory}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
After I just run the install passing the -DoutputDirectory parameter....
Try this...
To view all the plugin dependencies you can run a dependency:tree on the pom (where the plugin in configured)

no any "plugin descriptor" founded in my maven project

I am wanting to create UI with qt-jambi, but i have a problem.
i am using maven in eclipse, and create a maven project, and i downloaded and installed 3rd party qt-jambi jar files in my local repository from here:
http://old.qt-jambi.org/maven2/net/sf/qtjambi/
and below files:
(1) qtjambi-maven-plugin-linux32-4.5.2_01.jar
(2) qtjambi-platform-linux32-4.5.2_01.jar
i am using ubuntu 12.10(32bit) and Maven 3.0.4.
My maven repository(m2 home)path for qt-jambi is like below:
/home/mehdi/.m2/repository/net/sf/qtjambi/qtjambi/4.5.2_01/qtjambi-4.5.2_01.jar
/home/mehdi/.m2/repository/net/sf/qtjambi/qtjambi-maven-plugin-linux32/4.5.2_01/qtjambi-maven-plugin-linux32-4.5.2_01.jar
so i add this lines to my pom.xml: http://old.qt-jambi.org/users/maven-repository/
my pom.xml file is:
<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.iyasin</groupId>
<artifactId>iycTest</artifactId>
<version>2.0</version>
<packaging>jar</packaging>
<name>iycTest</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>net.sf.qtjambi</groupId>
<artifactId>qtjambi</artifactId>
<version>4.5.2_01</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>net.sf.qtjambi</groupId>
<artifactId>qtjambi-maven-plugin-linux32</artifactId>
<executions>
<execution>
<id>qtjambi</id>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<sourcesDir>src/main/java</sourcesDir>
<noObsoleteTranslations>true</noObsoleteTranslations>
</configuration>
</plugin>
</plugins>
</build>
</project>
and when run mvn test or mvn compile return me below error:
Failed to parse plugin descriptor for net.sf.qtjambi:qtjambi-maven-plugin-linux32:4.5.2_01 (/home/mehdi/.m2/repository/net/sf/qtjambi/qtjambi-maven-plugin-linux32/4.5.2_01/qtjambi-maven-plugin-linux32-4.5.2_01.jar): No plugin descriptor found at META-INF/maven/plugin.xml -> [Help 1]
You need to add into the relevant part of your POM:
<pluginRepositories>
<pluginRepository>
<id>qtjambi-releases-before-2011</id>
<name>QtJambi (Releases Before 2011)</name>
<url>http://repository.qt-jambi.org/nexus/content/repositories/releases-before-2011</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
The above can be put into your settings.xml or project POM.
You should really run a local repository proxy (such as Nexus or Artifactory). Then setup your settings.xml to point to that local repository. Then configure it to cache central and qtjambi and other repositories you use. However that benefits of this are too long to go into here, best to research the topic with google.

How to get jenkins to deploy .war file to tomcat6 not localhost

I have a jenkins ci that builds our projects and make a .war file of it.
But i canĀ“t get it to deploy to jenkins, how do i do that?
My pom.xml looks like this:
<?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>MavenWeb</groupId>
<artifactId>MavenWeb</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<description></description>
<distributionManagement>
<repository>
<uniqueVersion>false</uniqueVersion>
<id>e-ject.se</id>
<name>e-ject.se</name>
<url>http://e-ject.se/MavenWeb</url>
<layout>default</layout>
</repository>
</distributionManagement>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.0.1</version>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat6-maven-plugin</artifactId>
<version>2.0-beta-1</version>
<configuration>
<url>http://e-ject.se:8080/manager</url>
<server>e-ject.se</server>
<path>/MavenWeb</path>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
</dependencies>
</project>
And i added all info in settings.xml i found on the web. I can login to e-ject.se:8080/manager/html with the username and password.
<server>
<id>e-ject.se</id>
<username>jonathan</username>
<password>*****</password>
<filePermissions>664</filePermissions>
<directoryPermissions>775</directoryPermissions>
<configuration></configuration>
</server>
I get this in the jenkins console:
mavenExecutionResult exceptions not empty
message : Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy (default-deploy) on project MavenWeb:
Failed to deploy artifacts: Could not transfer artifact MavenWeb:MavenWeb:war:0.0.1-20120412.150346-1 from/to e-ject.se
(http://e-ject.se/MavenWeb): Failed to transfer file: http://e-ject.se/MavenWeb/MavenWeb/MavenWeb/0.0.1-SNAPSHOT/MavenWeb-0.0.1-20120412.150346-1.war.
Return code is: 405
If i just add tomcat:deploy in jenkins instead of deploy
i get:
mavenExecutionResult exceptions not empty
message : Failed to execute goal org.codehaus.mojo:tomcat-maven-plugin:1.1:deploy (default-cli) on project MavenWeb: Cannot invoke Tomcat manager
cause : Cannot invoke Tomcat manager
and later:
Caused by: java.io.IOException: Server returned HTTP response code: 401 for URL: http://localhost:8080/manager/deploy?path=%2FMavenWeb&war=
Can someone please help me get this to work, i have read a ton of guides but i cannot get it to work!
Regard
Jonathan
I realized i had more than one jenkins installed maven and i had previouse installations that misslead me! Sometimes its just better to just start over and do it right.

Onejar, with maven, won't copy resource into jar

I'm using one-jar to package up my program. I have resources in src/main/resources. The maven-resources-plugin correctly copies the resources into the jar, but the jar produced by onejar does not contain my resources.
Here's my 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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.ziroby</groupId>
<artifactId>resourceTest</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>resourceTest</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.dstovall</groupId>
<artifactId>onejar-maven-plugin</artifactId>
<version>1.4.4</version>
<executions>
<execution>
<configuration>
<attachToBuild>true</attachToBuild>
</configuration>
<goals>
<goal>one-jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<pluginRepositories>
<pluginRepository>
<id>onejar-maven-plugin.googlecode.com</id>
<url>http://onejar-maven-plugin.googlecode.com/svn/mavenrepo</url>
</pluginRepository>
</pluginRepositories>
</project>
What am I doing wrong? How do I include resources in one-jar?
I have discovered my error. It was putting it in the jar, just not where I expected it to be. It's contained in a jar inside the main jar. Specifically, resourceTest-0.0.1-SNAPSHOT.one-jar.jar contains resourceTest-0.0.1-SNAPSHOT.jar, which contains my resource.
Now I just need to find out how to access the resource, but that's another question, which warrants more research.
If you are using something similar to:
getClass().getClassLoader().getResourceAsStream
Try instead using: Thread.currentThread().getContextClassLoader().getResourceAsStream

Resources