Maven error :The artifactId cannot be empty in windows system - maven

Can any one help out of this:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.
4:assembly (bin-assembly) on project ingest-scripts: Execution bin-assembly of g
oal org.apache.maven.plugins:maven-assembly-plugin:2.4:assembly failed: For arti
fact {rome:null:null:jar}: The artifactId cannot be empty. -> [Help 1]

Maybe it's because you forgot the groupID
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
</plugin>
That's just a guess!
Please tell me, if it's working this way...

Related

Sonar maven plugin without settings.xml

I need change the sonar url without change settings.xml, so i have the following:
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.4.1.1168</version>
<configuration>
<sonar.host.url>http://sonar.viavarejo.com.br</sonar.host.url>
</configuration>
</plugin>
My sonar.host.url didn't work, just ignore, see the error:
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.4.1.1168:sonar (default-cli) on project myproject: Unable to execute SonarQube: Fail to get bootstrap index from server: Failed to connect to localhost/0:0:0:0:0:0:0:1:9000: Connection refused (Connection refused) -> [Help 1]
Important: I can't change the settings.xml file.
You can set the URL as a property:
<properties>
<sonar.host.url>http://<server>:<port>/</sonar.host.url>
</properties>
or directly in the command line usind
mvn sonar:sonar -Dsonar.host.url=http://<server>:<port>/

Create an EAR using Maven

I want to create an EAR using Maven, but since I'm in a pure Tycho world, I can't use the maven-ear-plugin, just the maven-assembly-plugin (which is fine).
There are multiple questions even on this very site that indicate that the maven-assembly-plugin can build EARs, even though the documentation says no.
However, when I use define the EAR format like this:
<formats>
<format>ear</format>
</formats>
I get the following exception:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:3.0:single (make-assembly) on project org.acme.application: Failed to create assembly: Error creating assembly archive default: appxml attribute is required -> [Help 1]
(I tried a couple of versions for the maven-assembly-plugin, so it's not that.)
Since a EAR is just a renamed JAR, I'm now using the JAR format and this other Maven plug-in:
<plugin>
<groupId>com.coderplus.maven.plugins</groupId>
<artifactId>copy-rename-maven-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<id>rename-ear</id>
<phase>verify</phase>
<goals>
<goal>rename</goal>
</goals>
<configuration>
<sourceFile>${basedir}/target/${earName}.jar</sourceFile>
<destinationFile>${basedir}/target/${earName}.ear</destinationFile>
</configuration>
</execution>
</executions>
</plugin>
Which works nicely in creating an EAR, however with mvn install it brings the following exception:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.5.2:install (default-install) on project org.acme.application: Failed to install artifact group:org.acme.application:jar:1.9.126-SNAPSHOT: C:\workspace\Application\target\Application.jar (Das System kann die angegebene Datei nicht finden) -> [Help 1]
(It's German for "Cannot find file", one day I'll get him to print out readable error messages.)
Of course, now I could copy the JAR to an EAR instead of just renaming it, but I thought I get a 2nd oppinion first: Is it possible to create an EAR with the maven-assembly-plugin? If so, how?

Defining suppressions filter in checkstyle.xml vs pom.xml - maven-checkstyle plugin

So here in my case, checkstyle-suppressions.xml is specified in both checkstyle.xml and pom.xml:
checkstyle.xml:
<module name="SuppressionFilter">
<property name="file" value="checkstyle-suppressions.xml"/>
</module>
pom.xml
<project>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.17</version>
<configuration>
<configLocation>checkstyle.xml</configLocation>
<suppressionsLocation>checkstyle-suppressions.xml</suppressionsLocation>
</configuration>
</plugin>
</plugins>
</reporting>
</project>
I'm not quite sure whether there's the need to define it in both files, one with SuppressionFilter module and <suppressionsLocation> tag in the pom.
And I want use https://github.com/openmrs/openmrs-core/blob/master/checkstyle.xml with other projects. However when doing so with <configLocation> set to https://github.com/openmrs/openmrs-core/blob/master/checkstyle.xml in the pom.xml, checkstyle-plugin fails with error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:2.17:check (validate) on project webservices.rest: Failed during checkstyle configuration: cannot initialize module SuppressionFilter - Cannot set property 'file' to 'checkstyle-suppressions.xml' in module SuppressionFilter: InvocationTargetException: Unable to find: checkstyle-suppressions.xml -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:2.17:check (validate) on project webservices.rest: Failed during checkstyle configuration
Caused by: org.apache.maven.plugin.MojoExecutionException: Failed during checkstyle configuration
Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: cannot initialize module SuppressionFilter - Cannot set property 'file' to 'checkstyle-suppressions.xml' in module SuppressionFilter
Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: Cannot set property 'file' to 'checkstyle-suppressions.xml' in module SuppressionFilter
I'm not quite sure whether there's the need to define it in both files
No need. If defined in the POM, maven will add it to the configuration behind the scenes.
Failed during checkstyle configuration
Unable to find: checkstyle-suppressions.xml
It was unable to find your file to load.
It tries to find the file as a direct file system path (relative paths should be based off your current working directory), a URL, or a resource in your program. http://checkstyle.sourceforge.net/config_filters.html#SuppressionFilter

Could not transfer artifact jlibs:jlibs-xml:pom:1.0 from/to kepler

I am running the pom.xml with in the Myeclipse window. Getting the error related to Kepler repository. Not sure why I am seeing this error. Please refer the error stack below -
[ERROR] Failed to execute goal org.raml.plugins:jaxrs-raml-maven-plugin:1.3.3:generate-raml (default) on project Service: Execution default of goal org.raml.plugins:jaxrs-raml-maven-plugin:1.3.3:generate-raml failed: Plugin org.raml.plugins:jaxrs-raml-maven-plugin:1.3.3 or one of its dependencies could not be resolved: Failed to collect dependencies for org.raml.plugins:jaxrs-raml-maven-plugin:jar:1.3.3 (): Failed to read artifact descriptor for jlibs:jlibs-xml:jar:1.0: Could not transfer artifact jlibs:jlibs-xml:pom:1.0 from/to kepler (http://download.eclipse.org/releases/kepler): No connector available to access repository kepler (http://download.eclipse.org/releases/kepler) of type p2 using the available factories AsyncRepositoryConnectorFactory, WagonRepositoryConnectorFactory -> [Help 1]
I am using the below maven code -
<plugin>
<groupId>org.raml.plugins</groupId>
<artifactId>jaxrs-raml-maven-plugin</artifactId>
<version>1.3.3</version>
<configuration>
<sourcePaths>
<param>${basedir}/src/main/java/Service.java</param>
</sourcePaths>
<sourceDirectory>${basedir}/src/main/java</sourceDirectory>
<outputFile>${project.build.directory}/generated-sources/jaxrs-raml/example.raml</outputFile>
</configuration>
<executions>
<execution>
<goals>
<goal>generate-raml</goal>
</goals>
<phase>process-classes</phase>
</execution>
</executions>
Not facing similar while running the plug in code for "raml-jaxrs-maven-plugin"
Any help would be appreciated.

How do I run an individual test in Maven?

We're using Maven 3.0.3 and are using JUnit 4.8.1 ...
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
<scope>test</scope>
</dependency>
We have this test file ...
./src/test/java/com/myco/clearing/common/xml/TextNodeTest.java
How can I run this individual test? When I try
mvn -Dtest=TextNodeTest test
I get an error saying no tests were run. I get the same error if I specify the entire package name to my test. ...
mvn clean -Dtest=com.myco.clearing.common.xml.TextNodeTest test
which produces the error message ...
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project myco-productplus-web: No tests were executed!
(Set -DfailIfNoTests=false to ignore this 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 the surefire configuration I'm using
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12</version>
<configuration>
<skip>false</skip>
<additionalClasspathElements>
<additionalClasspathElement>${project.build.sourceDirectory}</additionalClasspathElement>
<additionalClasspathElement>${project.build.testSourceDirectory}</additionalClasspathElement>
</additionalClasspathElements>
<useManifestOnlyJar>false</useManifestOnlyJar>
<forkMode>always</forkMode>
<systemProperties>
<property>
<name>gwt.args</name>
<value>-out "${webappDirectory}"</value>
</property>
</systemProperties>
<systemPropertyVariables>
<tomcat.port>${tomcat.servlet.port}</tomcat.port>
<project.artifactId>${project.artifactId}</project.artifactId>
</systemPropertyVariables>
</configuration>
</plugin>
The way to run a single test (method) in surefire is to do:
mvn test -Dtest=uk.co.farwell.AppTest#testSlow
Note the # instead of the space between the class name and the method name.
However, as #Andrew says, there is a bug in 2.12 (SUREFIRE-827: Surefire 2.12 cannot run a single test, regression from 2.11), but it works in 2.11.
The above bug is still open (as of 24.02.2012), but actually works for me using 2.13-SNAPSHOT.
EDIT: This is now marked as fixed in 2.12.1.
Looks like it's a bug in 2.12 version - SUREFIRE-827. Try downgrading to 2.11.
Like the others say, it's a bug in Surefire and it's fixed since version 2.11.1.

Resources