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

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

Related

Trying to analyze Gson project with sonarQube "Failed to execute goal biz.aQute.bnd:bnd-maven-plugin:6.2.0:bnd-process (default) on project gson"

I have downloaded a .zip of the official Gson project repo from github.
I have docker installed And I'm trying to analyze Gson with SonarQube.
I have chose the local project option and created a new token and chose maven to analyze:
when I run this command:
mvn clean verify sonar:sonar -Dsonar.projectKey=GSON-res -Dsonar.host.url=http://localhost:9000 -Dsonar.login=token_code
I get this error:
[ERROR] Failed to execute goal biz.aQute.bnd:bnd-maven-plugin:6.2.0:bnd-process (default) on project gson: Classes found in the wrong directory: {com/google/gson/package-info.class=com\google\gson\package-info, com/google/gson/internal/package-info.class=com\google\gson\internal\package-info, com/google/gson/reflect/package-info.class=com\google\gson\reflect\package-info, com/google/gson/stream/package-info.class=com\google\gson\stream\package-info, com/google/gson/annotations/package-info.class=com\google\gson\annotations\package-info} -> [Help 1]
This appears to be unrelated to SonarQube and is caused by a bug in the Maven Compiler Plugin version used by Gson: MCOMPILER-485
The Maven Compiler Plugin dependency of Gson has been updated to the fixed version 3.10.1, so this issue should be solved once you pull the latest Gson source code again.

Logging error when executing Maven SonarQube plugin

I've been facing an issue with Maven SonarQube plugin (v2.6) when Maven version is recent (strictly larger than 3.1).
Here is what I run:
mvn clean verify -Psonar
mvn org.codehaus.mojo:sonar-maven-plugin:2.6:sonar -Psonar
The first invocation makes sure sources are compiled and JaCoCo agent is prepared.
The interesting part comes, when the second command is run:
[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.6:sonar (default-cli) on project merlin-schema: Error setting Log implementation. Cause: java.lang.reflect.InvocationTargetException: org/slf4j/Marker -> [Help 1]
Any fix to be published?
Replacing default Maven logging implementation is currently not supported. Ticket created: http://jira.sonarsource.com/browse/MSONAR-122

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

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.

Configuring Maven, jenkins with Sonar

I have installed Jenkins and Sonar, both work fine. I am able to build a maven android project using Jenkins. No i want to run Sonar on the android project. I have installed the Sonar plugin in Jenkins. Configured the sonar module in the configure system module and added a post build task for sonar to run
[ERROR] Plugin org.codehaus.mojo:sonar-maven-plugin:sonar or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.codehaus.mojo:sonar-maven-plugin:jar:sonar: Could not find artifact org.codehaus.mojo:sonar-maven-plugin:pom:sonar in nbs-repo (http://10.10.2.89:8081/nexus/content/groups/public/) -> [Help 1]
org.apache.maven.plugin.PluginResolutionException: Plugin org.codehaus.mojo:sonar-maven-plugin:sonar or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.codehaus.mojo:sonar-maven-plugin:jar:sonar
at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:129)
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getPluginDescriptor(DefaultMavenPluginManager.java:142)
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getMojoDescriptor(DefaultMavenPluginManager.java:261)
at org.apache.maven.plugin.DefaultBuildPluginManager.getMojoDescriptor(DefaultBuildPluginManager.java:185)
at org.apache.maven.lifecycle.internal.MojoDescriptorCreator.getMojoDescriptor(MojoDescriptorCreator.java:235)
at org.apache.maven.lifecycle.internal.DefaultLifecycleTaskSegmentCalculator.calculateTaskSegments(DefaultLifecycleTaskSegmentCalculator.java:106)
at
My nexus installation works fine ? What am i doing wrong. My maven pom.xml does not contain any sonar plugin. What am i doing wrong?
Kind Regards
From the error message its clear that mvn is trying to download the sonar-maven-plugin from your local Nexus repository which does not seem to have it.
Try mvn -U in the build in case you already have the plugin.This overrides the negative cache. Another thing is <updatepolicy> in your settings.xml
If you don't have the plugin and neither does your Nexus connect to the internet, you have to manually download and upload in Nexus of course. Please remember to match the version of the plugin with the SONAR installation. Also there would be a few (7-10) transitive dependencies with the plugin which you will need. I suggest using mvn -X or mvn -e to see a verbose output during your testing.

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?

Resources