NullPointerException when trying to create allure report by allure-jenkins-plugin - maven

When I try to create allure report by allure-jenkins-plugin I get such error:
ERROR: Publisher ru.yandex.qatools.allure.jenkins.AllureReportPublisher aborted due to exception
java.io.IOException: java.lang.NullPointerException
at ru.yandex.qatools.allure.jenkins.utils.ReportGenerator.invoke(ReportGenerator.java:50)
at ru.yandex.qatools.allure.jenkins.utils.ReportGenerator.invoke(ReportGenerator.java:25)
at hudson.FilePath.act(FilePath.java:991)
at hudson.FilePath.act(FilePath.java:969)
at ru.yandex.qatools.allure.jenkins.AllureReportPublisher.generateReport(AllureReportPublisher.java:267)
at ru.yandex.qatools.allure.jenkins.AllureReportPublisher.perform(AllureReportPublisher.java:146)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:764)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:724)
at hudson.model.Build$BuildExecution.post2(Build.java:185)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:671)
at hudson.model.Run.execute(Run.java:1769)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:374)
Caused by: java.lang.NullPointerException
at ru.yandex.qatools.clay.internal.AetherUtils.getRepositoriesAsList(AetherUtils.java:183)
at ru.yandex.qatools.clay.Aether.<init>(Aether.java:60)
at ru.yandex.qatools.clay.Aether.aether(Aether.java:78)
at ru.yandex.qatools.allure.jenkins.utils.ReportGenerator.createAether(ReportGenerator.java:69)
at ru.yandex.qatools.allure.jenkins.utils.ReportGenerator.invoke(ReportGenerator.java:45)
... 14 more
xml-file created by allure is valid (I may create correct report with maven goal "site" with the same xml), so the problem must be in jenkins plugin.
I have maven 3.2.5 installed, settings.xml exists in ~/.m2 directory and seems to be correct.
What may be the reason of such error? Seems that it's somehow connected with maven settings.

It might happen due to :
Allure is not installed in the Jenkin.
STEPS:
Go to Manage Jenkins >
Global Tool Configuration >
Allure Commandline >
Add Allure Commandline >
Uncheck "Install automatically"
Download the latest allure commandline from maven repo - https://repo.maven.apache.org/maven2/io/qameta/allure/allure-commandline/
Unzip the file and provide the location
Installation directory : C:\allure-2.17.2 (I am using windows, jenkin)

The problem was in maven settings.xml file, in
<activeProfiles>
section. It contained profile, that in fact didn't exist. Removing this profile solved the problem.

Related

How to run Tests on Multiple versions of Maven with takari?

I am trying to run maven build on machine for facebook-swift. Some tests have #MavenVersions({"3.2.3", "3.2.5", "3.3.1"}) and running the mvn build fails with
The plugin io.takari.maven.plugins:takari-lifecycle-plugin:1.11.3 requires Maven version [3.2.1,) -> [Help 1]
[UPDATE]
After running with required version maven now the error is
java.lang.Exception: Could not resolve maven version 3.3.1
at io.takari.maven.testing.executor.junit.MavenJUnitTestRunner$1.error(MavenJUnitTestRunner.java:129)
at io.takari.maven.testing.executor.junit.MavenVersionResolver.resolve(MavenVersionResolver.java:58)
...
Caused by: java.io.FileNotFoundException: Could not download maven version 3.3.1 from any configured repository
at io.takari.maven.testing.executor.junit.MavenVersionResolver.createMavenInstallation(MavenVersionResolver.java:169)
at io.takari.maven.testing.executor.junit.MavenVersionResolver.resolve(MavenVersionResolver.java:56)
... 24 more
Caused by: java.io.IOException: HTTP/401 Unauthorized
at io.takari.maven.testing.executor.junit.MavenVersionResolver.openStream(MavenVersionResolver.java:198)
at io.takari.maven.testing.executor.junit.MavenVersionResolver.createMavenInstallation(MavenVersionResolver.java:152)
... 25 more
repeated for each version of maven specified in #MavenVersions
I read the takari docs but still at a loss why takari can't download or how to set it up so it is able download
[/UPDATE]
Here is the file in question https://github.com/facebook/swift/blob/master/swift-maven-plugin/src/test/java/com/facebook/mojo/SwiftIntegrationTest.java
My question is, How can I run the tests against multiple versions of Maven?
Thanks

maven error while running sonar from jenkins job

I am trying to implement Sonar in Jenkins CI using maven build tool.I am using Linux machine to build maven with Sonar.
maven is successfully installed. I have tried to configure maven path in Jenkins Configuration,
maven is installed .
whenever I run the job getting below error.
java.io.IOException: Cannot run program "mvn" (in directory
\"/directorypath"): java.io.IOException: error=2, No such file or directory""
as I understood from error that its unable to find out maven in Job directory. what configuration should needed so job can take by default maven path where is installed.
I have searched lot on internet, but could not helped.
Try without mvn in the commands
Eg clean install package

cloudbees jenkins maven installation missing

I am getting following error when building a project in jenkins:
ERROR: A Maven installation needs to be available for this project to be built.Either your server has no Maven installations defined, or the requested Maven version does not exist.
[cloudbees-deployer] Skipping deployment as build result is FAILURE
Finished: FAILURE
In Jenkins settings, I tried both options: automatic installation from apache as well as use pre-installed maven on dev#cloud.
What might be missing?

Maven with sonar authentication

I am running maven with sonar. Since I activated authentication on sonar for security purposes, since then I got the following error:
[ERROR] Can´t access to Sonar or project doesn't exist on Sonar instance. HTTP KO to http://localhost:9000/api/resources?resource=com.myproject.soft:soft&depth=0&format=xml
java.io.IOException: Can´t access to Sonar or project doesn't exist on Sonar instance.
at org.sonar.report.pdf.util.SonarAccess.getUrlAsDocument(SonarAccess.java:132)
at org.sonar.report.pdf.entity.Project.initializeProject(Project.java:98)
according to http://docs.sonarqube.org/display/SONAR/Analyzing+with+Maven I should use the following parameters:
-Dsonar.login=login -Dsonar.password=password
Those settings are not working for me.
The full command I am using is:
mvn install sonar:sonar -Dsonar.login=login -Dsonar.password=password
This is a limitation of the PDF Report Plugin that is developed by Klicap:
http://jira.codehaus.org/browse/SONARPLUGINS-1510
If you remove this plugin, then everything should be back to normal.
We have the same problem and resolved it by adding some credentials. Tested on Sonar 3.7 and Sonar PDF Plugin 1.3
In eclipse put this as your maven Goals:
org.codehaus.sonar-plugins.pdf-report:maven-pdfreport-plugin:1.3:generate -Dsonar.host.url=http://localhost:9000 -Dreport.type=executive -Dsonar.pdf.username=admin -Dsonar.pdf.password=admin

Maven release:perform not passing settings file to the deploy phase

I'm having an issue where Maven is not passing the settings to the deploy phase when I use the release plugin. I have my settings.xml file in the same folder as my pom.xml. When I run the following command it deploys successfully to the Maven repository.
mvn deploy -s settings.xml
However when I run this command, it fails saying that it doesn't have permissions to deploy to the repository.
mvn release:perform -B -s settings.xml
Here is the error message:
[INFO] [INFO] Error deploying artifact: Failed to transfer file: http://mavenrepo/groupId/artifactId/versionId/artifactId-versionId.pom. Return code is: 401
The only thing I can think that is causing the second to fail is that the release plugin doesn't pass the settings down to the deploy phase. How do I get this to work?
I used to have the MAVEN_OPTS environment variable set to specify my settings.xml file, but since this will run on from TeamCity, that is no longer an option.
I found a bug in the codehaus Jira for this same issue here. It was fixed in maven-release-plugin 2.2.2. As soon as I changed the version number in my pom.xml, it worked fine.

Resources