I am using this tool for first time, and I can't build a project correctly.
when i try the life cycle commands it builds succesfully with clean validate and compile. but when i try mvn test, it gives me this error :
[INFO] ---------------------------------------------------------------------
---
[INFO] BUILD FAILURE
[INFO] ---------------------------------------------------------------------
---
[INFO] Total time: 4.410 s
[INFO] Finished at: 2018-05-25T11:33:07+02:00
[INFO] ---------------------------------------------------------------------
---
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-
plugin:2.20.1:test (default-test) on project gdp: Execution default-test of
goal org.apache.maven.plugins:maven-surefire-plugin:2.20.1:test failed.
:NullPointerException
-> [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/PluginExecutionException
mvn -v 3.5.3
i am using a proxy and i did configure settings.xml file
Please help.
thank you
Change the version of maven-surefire-plugin via:
<project>
.
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.21.0</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
Related
I am trying to deploy maven project to heroku but it is showing error.
[INFO] Webapp assembled in [765 msecs]
[INFO] Building war:
C:\Users\Lenovo\Documents\GitHub\MakeMyEvent\target\MakeMyEvent-0.0.1-SNAPSHOT.war
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.406 s
[INFO] Finished at: 2018-08-23T16:16:19+05:30
[INFO] Final Memory: 16M/90M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-
plugin:2.2:war (default-war) on project MakeMyEvent: Error assembling WAR:
webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode) -> [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
it is a jsp project and working fine on my local machine.
As per the information you have provided here, your war building triggers the error.
basically if you are using maven war plugin try considering adding <failOnMissingWebXml>false</failOnMissingWebXml>
Example :
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
I have a jenkins build, how should call the sonar plugin. But every time i get the error:
Downloaded: http://xxxx:8081/nexus/content/groups/public/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar (165 KB at 20577.1 KB/sec)
[INFO] SonarQube version: 5.6.1
Downloading: http://talas:8081/nexus/content/groups/public/org/codehaus/sonar/sonar-maven3-plugin/5.6.1/sonar-maven3-plugin-5.6.1.pom
Downloading: https://repo.maven.apache.org/maven2/org/codehaus/sonar/sonar-maven3-plugin/5.6.1/sonar-maven3-plugin-5.6.1.pom
[WARNING] The POM for org.codehaus.sonar:sonar-maven3-plugin:jar:5.6.1 is missing, no dependency information available
Downloading: http://xxxx:8081/nexus/content/groups/public/org/codehaus/sonar/sonar-maven3-plugin/5.6.1/sonar-maven3-plugin-5.6.1.jar
Downloading: https://repo.maven.apache.org/maven2/org/codehaus/sonar/sonar-maven3-plugin/5.6.1/sonar-maven3-plugin-5.6.1.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 07:53 min
[INFO] Finished at: 2016-09-13T12:42:59+02:00
[INFO] Final Memory: 58M/1705M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.2:sonar (default-cli) on project Core: Can not execute SonarQube analysis: Plugin org.codehaus.sonar:sonar-maven3-plugin:5.6.1 or one of its dependencies could not be resolved: Could not find artifact org.codehaus.sonar:sonar-maven3-plugin:jar:5.6.1 in server0001 (http://xxx:8081/nexus/content/groups/public/) -> [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
Build step 'Invoke top-level Maven targets' marked build as failure
Finished: FAILURE
in my pom.xml i use the dependency:
<plugin>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>5.1</version>
</plugin>
I do not understand, why maven uses an other plugin than this which is included as dependency.
The Jenkins Job calls the following Targets:
clean
compile
sonar:sonar
-Dsonar.jdbc.url=jdbc:oracle:thin:#oracle11db:1521/orcl
-Dsonar.host.url=http://192.168.0.100:9000
I use Jenkins Version 2.21.
SonarQube scanner 2.6.1 is configured in global configuration
I also tried to call
org.codehaus.mojo:sonar-maven-plugin:2.3:sonar
directly. but it needs java8 and my Project was build with Java7
have you tried using the plugin from org.codehaus.mojo?
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>2.3</version>
</plugin>
Source:
http://docs.sonarqube.org/display/HOME/Frequently+Asked+Questions
We have been trying to integrate kafka-storm by referring the Learning Storm book. We have followed all the steps but on execution of the following command we are getting 'Build Failure'-
mvn clean compile exec:java
-Dmain.class=com.learningstorm.kafka.KafkaTopology
and the error is as follows-
[INFO] BUILD FAILURE
[INFO]------------------------------------------------------------------------
[INFO] Total time: 3.546s
[INFO] Finished at: Sat Jan 31 11:46:58 IST 2015
[INFO] Final Memory: 7M/111M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java (default-cli) on project storm-example: The parameters 'mainClass' for goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java are missing or invalid -> [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/PluginParameterException
What should we do? Thanks in advance!
Add the dependency
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
</dependency>
When I attempt to run below maven plugin using this command :
com.wordpress.pomfromjarmavenplugin:generate:0.0.1-SNAPSHOT:generatepom
I get this error :
Downloading:
https://oss.sonatype.org/content/repositories/snapshots/com/wordpress/pomfromjarmavenplugin/generate/0.0.1-SNAPSHOT/generate-0.0.1-SNAPSHOT.pom
[WARNING] The POM for
com.wordpress.pomfromjarmavenplugin:generate:jar:0.0.1-SNAPSHOT is
missing, no dependency information available [INFO]
------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO]
------------------------------------------------------------------------ [INFO] Total time: 1.862s [INFO] Finished at: Fri Nov 09 11:15:47 GMT
2012 [INFO] Final Memory: 5M/15M [INFO]
------------------------------------------------------------------------ [ERROR] Plugin
com.wordpress.pomfromjarmavenplugin:generate:0.0.1-SNAPSHOT or one of
its dependencies could not be resolved: Failed to read artifact
descriptor for
com.wordpress.pomfromjarmavenplugin:generate:jar:0.0.1-SNAPSHOT: Could
not find artifact
com.wordpress.pomfromjarmavenplugin:generate:pom:0.0.1-SNAPSHOT in
apache.snapshots
(https://oss.sonatype.org/content/repositories/snapshots/) -> [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
Problem seems to be that all of the pom files have timestamps associated with them :
https://oss.sonatype.org/content/repositories/snapshots/com/wordpress/pomfromjarmavenplugin/generate/0.0.1-SNAPSHOT/
How can I run this plugin ? Do I need to wait until the plugin is released or somehow instruct maven to run the latest version of the snapshot ?
Add these lines to your pom:
<pluginRepositories>
<pluginRepository>
<id>oss.sonatype</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</pluginRepository>
</pluginRepositories>
Then your command should work:
mvn com.wordpress.pomfromjarmavenplugin:generate:0.0.1-SNAPSHOT:generatepom
Or add these lines to your pom:
<build>
<plugins>
<plugin>
<groupId>com.wordpress.pomfromjarmavenplugin</groupId>
<artifactId>generate</artifactId>
<version>0.0.1-SNAPSHOT</version>
</plugin>
</plugins>
</build>
And then issue:
mvn generate:generatepom
I am trying to create a custom ant plugin for Maven, based on multiple build scripts. There is a note in the documentation about it: http://maven.apache.org/guides/plugin/guide-ant-plugin-development.html (see "A Note on Multiple Build Scripts"), but I have not been able to make it work.
Here are the scripts:
<root>\src\main\scripts\A.build.xml
-----------------------------------
<project>
<import file="C.build.xml"/>
<target name="hello" depends="dependency">
<echo>Hello, World</echo>
</target>
</project>
<root>\src\main\scripts\A.mojos.xml
-----------------------------------
<pluginMetadata>
<mojos>
<mojo>
<goal>hello</goal>
<call>hello</call>
</mojo>
</mojos>
</pluginMetadata>
<root>\src\main\scripts\B.build.xml
-----------------------------------
<project>
<target name="hello">
<echo>Hello, World</echo>
</target>
</project>
<root>\src\main\scripts\B.mojos.xml
-----------------------------------
<pluginMetadata>
<mojos>
<mojo>
<goal>hello2</goal>
<call>hello</call>
</mojo>
</mojos>
</pluginMetadata>
<root>\src\main\scripts\C.build.xml
-----------------------------------
<project>
<target name="dependency">
<echo>This is the dependency</echo>
</target>
</project>
<root>\pom.xml
--------------
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.myproject.plugins</groupId>
<artifactId>hello-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>maven-plugin</packaging>
<name>Hello Plugin</name>
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-script-ant</artifactId>
<version>2.2.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-plugin-plugin</artifactId>
<version>2.9</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-tools-ant</artifactId>
<version>2.9</version>
</dependency>
</dependencies>
<configuration>
<goalPrefix>hello</goalPrefix>
</configuration>
</plugin>
</plugins>
</build>
</project>
At the root level, I run "mvn clean install", which is successful.
Then I run "mvn org.myproject.plugins:hello-plugin:hello2", which is also successful and produces the "Hello, World" output.
However, when running "mvn org.myproject.plugins:hello-plugin:hello", I get this:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Hello Plugin 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- hello-plugin:1.0-SNAPSHOT:hello (default-cli) # hello-plugin ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.531s
[INFO] Finished at: Thu Mar 08 12:52:25 PST 2012
[INFO] Final Memory: 3M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.myproject.plugins:hello-plugin:1.0-SNAPSHOT:hello (default-cli) on project hello-plug
in: Failed to execute: Executing Ant script: A.build.xml [hello]: Failed to parse. Cannot find C.build.xml imported from
C:\DOCUME~1\joanes\LOCALS~1\Temp\plexus-ant-component9129296102162378706.build.xml -> [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
My question is how does one make this work? By looking at the error, the script is executed in a temporary folder, hence it cannot find the imported C.build.xml. Is there a way to change that? What is the recommended way of accomplishing this?
Try using: import file="${basedir}/src/main/scripts/C.build.xml". It appears maven is re-writing or copying your script to a temp directory then executing it there. It then tries to import C.build.xml from that directory because there's no other path information for C.build.xml.