I am in the beginning phase of Maven. I created a project and was trying to use the command. what is missing at my end? I am trying to compile and run a TestSuite File:
mvn clean package
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>com.test.myProject</groupId>
<artifactId>myTest</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>egdsvTest</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
but i get the below exception after using it.
Exception
D:\MVN_Shirish_Project\Test>mvn clean package
[INFO] Scanning for projects...
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethrea
ded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Test 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # Test ---
[INFO] Deleting D:\MVN_Shirish_Project\Test\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # Test
---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources,
i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\MVN_Shirish_Project\Test\src\
main\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) # Test ---
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. b
uild is platform dependent!
[INFO] Compiling 1 source file to D:\MVN_Shirish_Project\Test\target\classe
s
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # eg
dsvTest ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources,
i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\MVN_Shirish_Project\Test\src\
test\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) #
Test ---
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. b
uild is platform dependent!
[INFO] Compiling 1 source file to D:\MVN_Shirish_Project\Test\target\test-c
lasses
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # Test ---
[INFO] Surefire report directory: D:\MVN_Shirish_Project\Test\target\surefi
re-reports
[WARNING] Missing POM for org.apache.maven.surefire:surefire-junit3:jar:2.12.4
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.968 s
[INFO] Finished at: 2014-10-14T12:28:09+05:30
[INFO] Final Memory: 7M/247M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.
12.4:test (default-test) on project Test: Unable to generate classpath: org
.apache.maven.artifact.resolver.MultipleArtifactsNotFoundException: Missing:
[ERROR] ----------
[ERROR] 1) org.apache.maven.surefire:surefire-junit3:jar:2.12.4
[ERROR]
[ERROR] Try downloading the file manually from the project website.
[ERROR]
[ERROR] Then, install it using the command:
[ERROR] mvn install:install-file -DgroupId=org.apache.maven.surefire -DartifactI
d=surefire-junit3 -Dversion=2.12.4 -Dpackaging=jar -Dfile=/path/to/file
[ERROR]
[ERROR] Alternatively, if you host your own repository you can deploy the file t
here:
[ERROR] mvn deploy:deploy-file -DgroupId=org.apache.maven.surefire -DartifactId=
surefire-junit3 -Dversion=2.12.4 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url
] -DrepositoryId=[id]
[ERROR]
[ERROR] Path to dependency:
[ERROR] 1) dummy:dummy:jar:1.0
[ERROR] 2) org.apache.maven.surefire:surefire-junit3:jar:2.12.4
[ERROR]
[ERROR] ----------
[ERROR] 1 required artifact is missing.
[ERROR]
[ERROR] for artifact:
[ERROR] dummy:dummy:jar:1.0
[ERROR]
[ERROR] from the specified remote repositories:
[ERROR] m1 (http://repo1.maven.org/maven2, releases=true, snapshots=false)
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[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 rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionE
xception
Maven works by creating a local repository in your desktop or the machine you have installed maven and running this goal.
In the process of maven running the goal, it first tries to get all the dependent jar files from Central repository as you have listed in your comments M1 or M2 and then stores them under C:/Users/yourname/.m2/repository folder (assuming you are using a windows machine) or the corresponding user folder in other OS systems.
Then it uses the jars to run the build as required per the goals given.
Now in your case, you got to figure out a way to connect to the repositories (check your settings.xml located in the .m2 folder in your User directory) and check if you can connect to the internet central maven repositories. If not you can get the jar file and manually install them as advised in the error you have got. Once you do that I think you should get past this issue. Let me know if you still have the issues.
In my case, it was caused by me doing an offline build (i.e. mvn -o install) and me not having that jar installed in my local Maven repository yet. Doing an online build (mvn install) fixed it.
Related
I need to parse a json file in my maven project.
For that I started with a simple import in my java file (App.java)
package com.mycompany.app;
import com.fasterxml.jackson.*;// <-------- HERE
public class App
{
public static void main( String[] args )
{
}
}
Then, I tried to compile the project by using mvn package but I got an error:
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------< com.mycompany.app:my-app >----------------------
[INFO] Building my-app 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) # my-app ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /tmp/my-app/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) # my-app ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /tmp/my-app/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /tmp/my-app/src/main/java/com/mycompany/app/App.java:[2,1] package com.fasterxml.jackson does not exist
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.628 s
[INFO] Finished at: 2022-05-10T15:31:39+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project my-app: Compilation failure
[ERROR] /tmp/my-app/src/main/java/com/mycompany/app/App.java:[2,1] package com.fasterxml.jackson does not exist
[ERROR]
[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
Here is how I built my maven project:
I created my maven project:
mvn -B archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.4
I modified the file App.java (created by the previous command) to match with my file.
I modified pom.xml in order to add the dependency:
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.13.2</version>
</dependency>
Do you know how to solve this error?
I've already recently answered a similar question: the problem is that com.fasterxml.jackson is not a package, there is a folder com/fasterxml/jackson (see the source), but not a package. In Java, package is a namespace that contains at least one class. Asterix import imports non-recursively all the classes in the package. So, if you need, let's say, to use classes JsonParser.java and JacksonException.java from the package com.fasterxml.jackson.core, you may add an asterix import like that: com.fasterxml.jackson.core.*
I am having difficulty in getting this ojdbc7 JAR file installed in the correct location. I tried the following from Windows 10 command prompt and got the BUILD SUCCESS message as shown below:
C:\Users\john>mvn install:install-file -Dfile=C:\ojdbc7.jar -DgroupId=com.oracle -DartifactId=ojdbc7 -Dversion=12.1.0.1 -Dpackaging=jar
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< org.apache.maven:standalone-pom >-------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- maven-install-plugin:2.4:install-file (default-cli) # standalone-pom ---
[INFO] Installing C:\ojdbc7.jar to C:\Users\l-john\.m2\repository\com\oracle\ojdbc7\12.1.0.1\ojdbc7-12.1.0.1.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.381 s
[INFO] Finished at: 2018-10-24T12:09:04-05:00
[INFO] ------------------------------------------------------------------------
However, when I went inside the 12.1.0.1 folder (located here C:\Users\john\.m2\repository\com\oracle\ojdbc7\12.1.0.1) I only saw the following files :
For one of my Maven project, eclipse(version 2018-19) is trying to access the JAR file and I keep getting following BUILD FAILURE message which is obvious since the file isn't there:
BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.208 s
[INFO] Finished at: 2018-10-24T12:15:39-05:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project MyProject: Could not resolve dependencies for project com.company.ii:MyProject:war:0.1: Could not find artifact com.oracle.jdbc:ojdbc7:jar:12.1.0.1 in spring-releases (https://repo.spring.io/libs-release) -> [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.
In my pom.xml, I do have the dependency defined as follows:
Is there anything I am doing wrong? Please let me know if I need to perform some additional testing?
I could see that in mvn install command -DgroupId is not correct, instead of giving "-DgroupId=com.oracle.jdbc", you have given just "-DgroupId=com.oracle"
Maven tells you it is installing the jar to
C:\Users\l-john\.m2\repository\com\oracle\ojdbc7\12.1.0.1\ojdbc7-12.1.0.1.jar
But you are looking at
C:\Users\john\.m2\repository\com\oracle\ojdbc7\12.1.0.1
l-john vs john
This error is posted in different forums even here. I have tried the different alternatives. I tried changing the POM permissions. I am using the default maven settings. JDK is 8, Maven 3.5.3.
I just want to try a very simple junit application. From the command line I have no problems running "mvn test"
junitexample amh$ mvn test
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------< com.junit:junit-example >-----------------------
[INFO] Building junit-example 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # junit-example ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # junit-example ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # junit-example ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /Users/amhg/Documents/dev/intellik2/junitexample/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # junit-example ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # junit-example ---
[INFO] Surefire report directory: /Users/amhg/Documents/dev/intellik2/junitexample/target/surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running CalculatorTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.045 sec
Results :
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.178 s
[INFO] Finished at: 2018-04-08T01:39:52+02:00
[INFO] ------------------------------------------------------------------------
But from Jenkins, from the Console Output I have this error:
Console Output
Started by user Andrea
Building in workspace /Users/Shared/Jenkins/Home/workspace/calc
[calc] $ /Users/amhg/apache-maven-3.5.3/bin/mvn -f /Users/amhg/Documents/dev/intellik2/junitexample test
POM file /Users/amhg/Documents/dev/intellik2/junitexample specified with the -f/--file command line argument does not exist
[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-readable POM /Users/amhg/Documents/dev/intellik2/junitexample: /Users/amhg/Documents/dev/intellik2/junitexample (Permission denied) #
#
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project (/Users/amhg/Documents/dev/intellik2/junitexample) has 1 error
[ERROR] Non-readable POM /Users/amhg/Documents/dev/intellik2/junitexample: /Users/amhg/Documents/dev/intellik2/junitexample (Permission denied)
[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
Build step 'Invoke top-level Maven targets' marked build as failure
Finished: FAILURE
This is my POM file
<?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.junit</groupId>
<artifactId>junit-example</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>junit-example</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
And I just have a simple test:
import org.junit.BeforeClass;
import org.junit.Test;
import static junit.framework.TestCase.assertEquals;
public class CalculatorTest {
private static ICalculator calculator;
#BeforeClass
public static void initCalculator() {
calculator = new Calculator();
}
#Test
public void testSum() {
int result = calculator.sum(3, 4);
assertEquals(7, result);
}
}
I donĀ“t know what else I could try. I opened all the topics related to the problem.
Any other suggestion?
I had exact same problem - local maven build works and Jenkins fails with the same error as yours.
Once Jenkins job is started, it will import source code to /your-jenkins/workspace/your-job-name folder and then start building. In your DSL, you have to mention the path to your pom in the workspace.
Take a look at the Jenkins workspace view to see where your pom is located once the source code is downloaded. This will aid in resolving the problem.
in the -f option you have provided. the maven is unable to identify the pom to read
-f /Users/amhg/Documents/dev/intellik2/junitexample test
try giving in the complete name of the pom including .xml
-f /Users/amhg/Documents/dev/intellik2/junitexample nameofpom.xml
Please check what you have in your Jenkins Build -> Goals and in your Build -> POM.
You probably switched those two.
Any help appreciated.
I'm new to Maven. I got the below command from tutorials point
mvn archetype:generate -DgroupId=com.tutorialpoint.app -DartifactId=camel-first-app -DarchetypeGroupId=org.apache.camel.archetypes -DarchetypeArtifactId=camel-archetype-spring -DinteractiveMode=false
it is failing with below error:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> maven-archetype-plugin:3.0.1:generate (default-cli) # standalone-pom >>>
[INFO]
[INFO] <<< maven-archetype-plugin:3.0.1:generate (default-cli) # standalone-pom <<<
[INFO]
[INFO] --- maven-archetype-plugin:3.0.1:generate (default-cli) # standalone-pom ---
Downloading:
http://repo.maven.apache.org/maven2/org/codehaus/groovy/groovy/1.8.3/groovy-1.8.3.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.981s
[INFO] Finished at: Tue Nov 14 23:11:42 IST 2017
[INFO] Final Memory: 10M/184M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3.0.1:generate (default-cli) on project standalone-pom: Execution default-cli of goal org.apache.maven.plugins:maven-archetype-plugin:3.0.1:generate failed: Plugin org.apache.maven.plugins:maven-archetype-plugin:3.0.1 or one of its dependencies could not be resolved: Could not transfer artifact org.codehaus.groovy:groovy:jar:1.8.3 from/to central (http://repo.maven.apache.org/maven2): GET request of: org/codehaus/groovy/groovy/1.8.3/groovy-1.8.3.jar from central failed: Connection reset -> [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/PluginResolutionException
Can someone please help.
The relevant error is pointing to a connection problem:
Could not transfer artifact org.codehaus.groovy:groovy:jar:1.8.3
from/to central (http://repo.maven.apache.org/maven2): GET request
of: org/codehaus/groovy/groovy/1.8.3/groovy-1.8.3.jar from central
failed: Connection reset
The command which you posted actually runs fine on my machine. If you execute this maven command and you do not have the Groovy libraries yet, you will see that it actually downloads the following files:
https://repo.maven.apache.org/maven2/org/codehaus/groovy/groovy/1.8.3/groovy-1.8.3.pom
https://repo.maven.apache.org/maven2/org/codehaus/groovy/groovy/1.8.3/groovy-1.8.3.jar
It might be that you have only access to the internet via a proxy. In this case you will need to setup a proxy in the Maven configuration.
This blog here contains a fairly good description on how to setup a proxy for Maven, so that Maven can access the repository libraries.
Another option to tackle your problem would be to manually download this file using your browser:
https://repo.maven.apache.org/maven2/org/codehaus/groovy/groovy/1.8.3/groovy-1.8.3.jar
And then install it in your repository manually using:
mvn install:install-file -Dfile=<path-to-file> -DgroupId=org.codehaus.groovy \
-DartifactId=groovy -Dversion=1.8.3 -Dpackaging=jar
But normally you should not have to do this manual download + installation. Maven should be doing this for you.
I'm trying to setup SonarQube.com on travis for a maven project, but I see the following exception on build:
[INFO] User cache: /home/travis/.sonar/cache
[INFO] Load global settings
[INFO] Load global settings (done) | time=456ms
[INFO] User cache: /home/travis/.sonar/cache
[INFO] Load plugins index
[INFO] Load plugins index (done) | time=16ms
[INFO] Download sonar-scm-cvs-plugin-1.0.jar
[INFO] Download sonar-scm-svn-plugin-1.3.jar
[INFO] Download sonar-plsql-plugin-2.9.0.901.jar
[INFO] Download sonar-csharp-plugin-5.8.0.660.jar
[INFO] Download sonar-java-plugin-4.7.1.9272.jar
[INFO] Download sonar-web-plugin-2.5.0.476.jar
[INFO] Download sonar-flex-plugin-2.3.jar
[INFO] Download sonar-xml-plugin-1.4.2.885.jar
[INFO] Download sonar-vbnet-plugin-3.0.3.346.jar
[INFO] Download sonar-swift-plugin-2.0.0.1127.jar
[INFO] Download sonar-python-plugin-1.7.0.1195.jar
[INFO] Download sonar-github-plugin-1.4.0.699.jar
[INFO] Download sonar-cfamily-plugin-4.6.0.7071.jar
[INFO] Download sonar-auth-github-plugin-1.3.jar
[INFO] Download sonar-rpg-plugin-2.1.0.736.jar
[INFO] Download sonar-scm-mercurial-plugin-1.1.1.jar
[INFO] Download sonar-googleanalytics-plugin-1.1.jar
[INFO] Download sonar-widget-lab-plugin-1.8.1.jar
[INFO] Download sonar-pli-plugin-1.5.0.702.jar
[INFO] Download sonar-javascript-plugin-2.21.0.4409.jar
[INFO] Download sonar-groovy-plugin-1.4.jar
[INFO] Download sonar-cobol-plugin-3.3.1.1636.jar
[INFO] Download sonar-scm-git-plugin-1.2.jar
[INFO] Download sonar-php-plugin-2.10.0.2087.jar
[INFO] Download sonar-abap-plugin-3.3.jar
[INFO] Download sonar-governance-plugin-2.0.0.1789.jar
[INFO] Download qualinsight-sonarqube-badges-3.0.1.jar
[INFO] SonarQube version: 6.3.0
[INFO] Default locale: "en_US", source code encoding: "UTF-8"
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:42 min
[INFO] Finished at: 2017-04-03T09:47:20+00:00
[INFO] Final Memory: 70M/468M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.3.0.603:sonar (default-cli) on project jraft: No license for governance -> [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/MojoExecutionException
Here is the .travis.yml:
language: java
jdk:
- oraclejdk8
addons:
sonarqube:
organization: ${SONAR_ORGANIZATION}
token:
secure: ${SONAR_TOKEN}
script:
- ./travis.sh
cache:
directories:
- $HOME/.m2/repository
- $HOME/.sonar
- $HOME/jvm
- $HOME/maven
Here is the travis.sh:
#!/bin/bash
set -e
INITIAL_VERSION=1.0-SNAPSHOT
export MAVEN_OPTS="-Xmx1G -Xms128m"
mvn package sonar:sonar \
$MAVEN_ARGS \
-Dsonar.host.url=$SONAR_HOST_URL \
-Dsonar.login=$SONAR_TOKEN \
-Dsonar.projectVersion=$INITIAL_VERSION
Why I am seeing this error No license for governance as I am not using any commercial sonar component (only sonar-java I suppose)?
The problem seems to be related to the fact that one of the plugins needs a commercial key, but How I can tell Travis to only install the java plugin?
Taking a look at your repository, you should not override the various parameters that the Travis Add-on is specifying for you.
More specifically, when you override SONAR_TOKEN on the Maven command line (at line 12), the consequence is that the token that you have encrypted and passed at line 11 of your .travis.yml file is completely wiped out. Because of this, your analysis is run like if you were anonymous.
So please follow the Get Started guide and simply run the following Maven command:
mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent package sonar:sonar
sonar-governance plugin is commercial plugin.
check here
.....
[INFO] Download sonar-governance-plugin-2.0.0.1789.jar
......
For me the below works from my jenkins pipeline
node{
stage 'Code Quality'
sh "mvn sonar:sonar -Dsonar.host.url=http://<hostname>:9000"
}