Maven Shade Plugin not attaching shaded artifact - maven

I'm trying to use the maven-shade-plugin to distinguish between Java 6 and Java 7 artifacts. My understanding from this link is that the original artifact will be replaced by the shaded one
[INFO] Replacing original artifact with shaded artifact.
[INFO] Replacing /Users/carlos/path/Libraries/xml/target/xml-1.5.0-SNAPSHOT.jar with /Users/carlos/path/Libraries/xml/target/xml-1.5.0-SNAPSHOT-SHADED.jar
[INFO] Replacing original test artifact with shaded test artifact.
[INFO] Replacing /Users/carlos/path/Libraries/xml/target/xml-1.5.0-SNAPSHOT-tests.jar with /Users/carlos/path/Libraries/xml/target/xml-1.5.0-SNAPSHOT-SHADED-tests.jar
[INFO] Dependency-reduced POM written at: /Users/carlos/path/Libraries/xml/dependency-reduced-pom.xml
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) # xml ---
[INFO] Installing /Users/carlos/path/Libraries/xml/target/xml-1.5.0-SNAPSHOT.jar to /Users/carlos/.m2/repository/com/company/xml/1.5.0-SNAPSHOT/xml-1.5.0-SNAPSHOT.jar
[INFO] Installing /Users/carlos/path/Libraries/xml/dependency-reduced-pom.xml to /Users/carlos/.m2/repository/com/company/xml/1.5.0-SNAPSHOT/xml-1.5.0-SNAPSHOT.pom
[INFO] Installing /Users/carlos/path/Libraries/xml/target/xml-1.5.0-SNAPSHOT-tests.jar to /Users/carlos/.m2/repository/com/company/xml/1.5.0-SNAPSHOT/xml-1.5.0-SNAPSHOT-tests.jar
[INFO] Installing /Users/carlos/path/Libraries/xml/target/xml-1.5.0-SNAPSHOT-sources.jar to /Users/carlos/.m2/repository/com/company/xml/1.5.0-SNAPSHOT/xml-1.5.0-SNAPSHOT-sources.jar
[INFO] Installing /Users/carlos/path/Libraries/xml/target/xml-1.5.0-SNAPSHOT-tests.jar to /Users/carlos/.m2/repository/com/company/xml/1.5.0-SNAPSHOT/xml-1.5.0-SNAPSHOT-tests.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 23.724 s
[INFO] Finished at: 2015-02-19T15:53:50-05:00
[INFO] Final Memory: 22M/631M
[INFO] ------------------------------------------------------------------------
However, it is installing without the SHADED classifier. Here is my shade plugin configuration:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<shadeTestJar>true</shadeTestJar>
<shadedClassifierName>SHADED</shadedClassifierName>
</configuration>
</execution>
</executions>
</plugin>
Can anyone tell me how to get it to install with the proper classifier? Also, I'm using this instead of the maven-jar-plugin because I need to be able to classify test jars as well.

You are missing <shadedArtifactAttached>true</shadedArtifactAttached> in the plugin configuration. Without it, the shaded jar will remain the main artifact of your project, so the classifier won't be applied (because the main artifact does not have a classifier).
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<shadeTestJar>true</shadeTestJar>
<shadedClassifierName>SHADED</shadedClassifierName>
<shadedArtifactAttached>true</shadedArtifactAttached>
</configuration>
</execution>
</executions>
</plugin>

Related

Build Failure creating Maven Zip for AWS device Farm

I'm getting a build failure when trying to create a zip for my Appium/selenium project. Any help would be appreciated.
I’m running this on MacOS HighSierra. I’m running this on MacOS HighSierra. Appium is version v1.10.1. The command I used to zip the file (or tried to use to zip the file) is in the first line from the terminal.This is the log from terminal:
cvarl-0046:powerleyappiumcucumber cvarl$ mvn clean package -DskipTests=true
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building TestngCucumberBoilerPlate 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # TestngCucumberBoilerPlate ---
[INFO] Deleting /Users/cvarl/Documents/PowerleyAppiumCucumber/target
[INFO]
[INFO] --- maven-resources-plugin:2.7:resources (default-resources) # TestngCucumberBoilerPlate ---
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /Users/cvarl/Documents/PowerleyAppiumCucumber/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.2:compile (default-compile) # TestngCucumberBoilerPlate ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.7:testResources (default-testResources) # TestngCucumberBoilerPlate ---
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 13 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.2:testCompile (default-testCompile) # TestngCucumberBoilerPlate ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 49 source files to /Users/cvarl/Documents/PowerleyAppiumCucumber/target/test-classes
[INFO] /Users/cvarl/Documents/PowerleyAppiumCucumber/src/test/java/main/CucumberRunner.java: Some input files use unchecked or unsafe operations.
[INFO] /Users/cvarl/Documents/PowerleyAppiumCucumber/src/test/java/main/CucumberRunner.java: Recompile with -Xlint:unchecked for details.
[INFO]
[INFO] --- maven-surefire-plugin:2.18.1:test (default-test) # TestngCucumberBoilerPlate ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-jar-plugin:3.1.1:jar (default-jar) # TestngCucumberBoilerPlate ---
[WARNING] JAR will be empty - no content was marked for inclusion!
[INFO] Building jar: /Users/cvarl/Documents/PowerleyAppiumCucumber/target/TestngCucumberBoilerPlate-0.0.1-SNAPSHOT.jar
[INFO]
[INFO] --- maven-assembly-plugin:2.5.4:single (default) # TestngCucumberBoilerPlate ---
[INFO] Reading assembly descriptor: src/main/assembly/zip.xml
[INFO] Building zip: /Users/cvarl/Documents/PowerleyAppiumCucumber/target/zip-with-dependencies.zip
[INFO]
[INFO] --- maven-dependency-plugin:3.1.1:copy (copy) # TestngCucumberBoilerPlate ---
[INFO] Configured Artifact: appiumcucumber:appiumcucumberproj:1:.zip
Downloading: https://github.com/igniteram/appiumcucumber/appiumcucumberproj/1/appiumcucumberproj-1.pom
Downloading: https://repo.maven.apache.org/maven2/appiumcucumber/appiumcucumberproj/1/appiumcucumberproj-1.pom
[WARNING] The POM for appiumcucumber:appiumcucumberproj:.zip:1 is missing, no dependency information available
Downloading: https://github.com/igniteram/appiumcucumber/appiumcucumberproj/1/appiumcucumberproj-1..zip
Downloading: https://repo.maven.apache.org/maven2/appiumcucumber/appiumcucumberproj/1/appiumcucumberproj-1..zip
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.379 s
[INFO] Finished at: 2019-02-06T17:03:10-05:00
[INFO] Final Memory: 25M/94M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:3.1.1:copy (copy) on project TestngCucumberBoilerPlate: Unable to find/resolve artifact. Could not find artifact appiumcucumber:appiumcucumberproj:.zip:1 in TestNG-Cucumber (https://github.com/igniteram) -> [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
cvarl-0046:powerleyappiumcucumber cvarl$
This is my 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/xsd/maven-4.0.0.xsd">
<repositories>
<repository>
<id>TestNG-Cucumber</id>
<name>testng-cucumber</name>
<url>https://github.com/igniteram</url>
</repository>
</repositories>
<packaging>jar</packaging>
<modelVersion>4.0.0</modelVersion>
<groupId>TestngCucumber</groupId>
<artifactId>TestngCucumberBoilerPlate</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-testng</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.14.3</version>
</dependency>
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>7.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.1</version>
<type>maven-plugin</type>
</dependency>
<!-- Added for comparing screenshots -->
<!-- https://mvnrepository.com/artifact/com.sikulix/sikulixapi -->
<dependency>
<groupId>com.sikulix</groupId>
<artifactId>sikulixapi</artifactId>
<version>1.1.0</version>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<testResources>
<testResource>
<directory>src/test/resources</directory>
<filtering>true</filtering>
</testResource>
</testResources>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.5.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<finalName>zip-with-dependencies</finalName>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>src/main/assembly/zip.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<id>copy</id>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>[ groupId ]</groupId>
<artifactId>[ artifactId ]</artifactId>
<version>[ version ]</version>
<type>[ packaging ]</type>
<classifier> [classifier - optional] </classifier>
<overWrite>true</overWrite>
<outputDirectory>${project.build.directory}/dependency-jars/</outputDirectory>
<destFileName>[ filename ]</destFileName>
</artifactItem>
</artifactItems>
<!-- other configurations here -->
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.7</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-filtering</artifactId>
<version>1.3</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.1</version>
</plugin>
</plugins>
</build>
</project>
Changing out my maven-dependency-plugin in the pom.xml with the one below fixed my build failures.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/dependency-jars/</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>

mvn does not run test on appCenter

I want to run my appium test on AppCenter and I have followed this documents
https://learn.microsoft.com/en-us/appcenter/test-cloud/preparing-for-upload/appium#prerequisites
When I run appium script on appCenter it does not show any error but give me output as
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------
[INFO] Building run-test 1.0-SNAPSHOT
[INFO] ----------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # run-test ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # run-test ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # run-test ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # run-test ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.20:test (default-test) # run-test ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.testscripts.RegressionTest
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.247 s - in com.testscripts.RegressionTest
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) # run-test ---
[WARNING] JAR will be empty - no content was marked for inclusion!
[INFO] Building jar: target/run-test-1.0-SNAPSHOT.jar
[INFO]
[INFO] --- maven-failsafe-plugin:2.20:integration-test (default) # run-test ---
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent! The file encoding for reports output files should be provided by the POM property ${project.reporting.outputEncoding}.
[INFO]
[INFO] --- maven-failsafe-plugin:2.20:verify (default) # run-test ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.623 s
[INFO] Finished at: 2018-08-06T07:39:58+02:00
[INFO] Final Memory: 17M/214M
[INFO] ------------------------------------------------------------------------
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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>Cure.fit</groupId>
<artifactId>Cure.fit</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Automation Test Project</name>
<description>Automation Test Project</description>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<includes>
<include>**/*Test.java</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
<!-- https://mvnrepository.com/artifact/junit/junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.appium/java-client -->
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>6.1.0</version>
</dependency>
<dependency>
<groupId>com.microsoft.appcenter</groupId>
<artifactId>appium-test-extension</artifactId>
<version>1.3</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>jcenter</id>
<url>https://jcenter.bintray.com/</url>
</repository>
</repositories>
<profiles>
<profile>
<id>repl</id>
<dependencies>
<dependency>
<groupId>com.javarepl</groupId>
<artifactId>javarepl</artifactId>
<version>428</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<configuration>
<executable>java</executable>
<classpathScope>test</classpathScope>
<arguments>
<argument>-Djansi.passthrough=true</argument>
<argument>-classpath</argument>
<classpath />
<argument>javarepl.Main</argument>
</arguments>
</configuration>
<executions>
<execution>
<id>runRepl</id>
<phase>process-test-classes</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<!-- Added for AppCenter/Test runs -->
<profile>
<id>prepare-for-upload</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/upload/dependency-jars/</outputDirectory>
<useRepositoryLayout>true</useRepositoryLayout>
<copyPom>true</copyPom>
<addParentPoms>true</addParentPoms>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-help-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>generate-pom</id>
<phase>package</phase>
<goals>
<goal>effective-pom</goal>
</goals>
<configuration>
<output>${project.build.directory}/upload/pom.xml</output>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-testclasses</id>
<phase>package</phase>
<goals>
<goal>testResources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/upload/test-classes</outputDirectory>
<resources>
<resource>
<directory>
${project.build.testOutputDirectory}
</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
When I run the same project as mvn test I am able to run the test.
I have kept my JUnit testcase name as RegressionTest.java under src/test/java which extends Support.java which is also Junit file.
Could any one can help me what is the mistake I am doing.

Multiple commands with Maven Exec plugin

I am struggeling a bit with the Maven Exec plugin. I want to execute two seperate mvn commands using the plugin so I only need to execute mvn exec:exec in order to execute all commands.
The following two commands work well seperately:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<configuration>
<executable>mvn</executable>
<arguments>
<argument>clean</argument>
</arguments>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<configuration>
<executable>mvn</executable>
<arguments>
<argument>package</argument>
</arguments>
</configuration>
</plugin>
And this is my attempt to combine both in order to execute them with one command:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<id>id1</id>
<phase>package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>mvn</executable>
<arguments>
<argument>clean</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>id2</id>
<phase>package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>mvn</executable>
<arguments>
<argument>package</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
Unfortunately, when I now execute mvn exec:exec I receive the following error message:
[INFO] Scanning for projects...
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building MyProjet 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- exec-maven-plugin:1.6.0:exec (default-cli) # MyProject ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.787 s
[INFO] Finished at: 2017-09-26T09:56:57+01:00
[INFO] Final Memory: 6M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.6.0:exec (default-cli) on project MyProject: The parameter 'executable' is 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/MojoExecutionException
When you run mvn exec:exec on the command-line, it runs an <execution> with an <id> of default-cli. This explains the error message, as there is no execution with <id>default-cli</id> that has an <executable> configured in your POM.
To solve your problem, have a look at the Guide to Configuring Plug-ins. It explains how to execute a goal from the command-line with an <id> other than default-cli:
mvn exec:exec#id1 exec:exec#id2

Failed to execute goal org.apache.maven.plugins: maven-assembly-plugin (GroupId cannot be empty)

I am very much new to maven and Oozie, when i am using the command,
./mkdistro.sh -DskipTests -Dmaven.javadoc.skip=true to build oozie from Oozie-3.3.2 bin folder, i am getting some error message like this.
Please help me, i am not able to find any answers on this issue.
I am working on Ubuntu (12.04.4 LTS) with java 1.8 (in pom.xml, i have already changed the version to 1.8) and maven 3.2.5 and hadoop version 1.2
[INFO] Reactor Summary:
[INFO]
[INFO] Apache Oozie Main .................................. SUCCESS [ 2.785 s]
[INFO] Apache Oozie Client ................................ SUCCESS [ 18.693 s]
[INFO] Apache Oozie Hadoop 1.1.1.oozie-3.3.2 .............. SUCCESS [ 1.592 s]
[INFO] Apache Oozie Hadoop Distcp 1.1.1.oozie-3.3.2 ....... SUCCESS [ 0.202 s]
[INFO] Apache Oozie Hadoop 1.1.1.oozie-3.3.2 Test ......... SUCCESS [ 0.369 s]
[INFO] Apache Oozie Hadoop 2.0.2-alpha.oozie-3.3.2 ........ FAILURE [ 0.241 s]
[INFO] Apache Oozie Hadoop 2.0.2-alpha.oozie-3.3.2 Test ... SKIPPED
[INFO] Apache Oozie Hadoop Distcp 2.0.2-alpha.oozie-3.3.2 . SKIPPED
[INFO] Apache Oozie Hadoop Libs ........................... SKIPPED
[INFO] Apache Oozie Hbase 0.94.2.oozie-3.3.2 .............. SKIPPED
[INFO] Apache Oozie Hbase Libs ............................ SKIPPED
[INFO] Apache Oozie Share Lib Pig ......................... SKIPPED
[INFO] Apache Oozie Share Lib Streaming ................... SKIPPED
[INFO] Apache Oozie Share Lib Distcp ...................... SKIPPED
[INFO] Apache Oozie Share Lib Hive ........................ SKIPPED
[INFO] Apache Oozie Share Lib Sqoop ....................... SKIPPED
[INFO] Apache Oozie Share Lib Oozie ....................... SKIPPED
[INFO] Apache Oozie Core .................................. SKIPPED
[INFO] Apache Oozie Tests ................................. SKIPPED
[INFO] Apache Oozie Tests For Pig ......................... SKIPPED
[INFO] Apache Oozie Docs .................................. SKIPPED
[INFO] Apache Oozie WebApp ................................ SKIPPED
[INFO] Apache Oozie Examples .............................. SKIPPED
[INFO] Apache Oozie Share Lib ............................. SKIPPED
[INFO] Apache Oozie Tools ................................. SKIPPED
[INFO] Apache Oozie MiniOozie ............................. SKIPPED
[INFO] Apache Oozie Distro ................................ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 26.145 s
[INFO] Finished at: 2016-10-08T12:44:38-07:00
[INFO] Final Memory: 33M/80M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.2.1:single (default-cli) on project oozie-hadoop: Execution default-cli of goal org.apache.maven.plugins:maven-assembly-plugin:2.2.1:single failed: For artifact {null:null:null:jar}: The groupId cannot be empty. -> [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
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :oozie-hadoop
ERROR, Oozie distro creation failed
A part of
Pom.xml
------------------------------------------------------------------------
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.7</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.5</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<!-- Don't change version as doc generation may fail -->
<!-- (using custom doxia for twiki pages generation) -->
<version>2.0-beta-6</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.3</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1</version>
</plugin>
<plugin>
<groupId>org.apache.rat</groupId>
<artifactId>apache-rat-plugin</artifactId>
<version>0.8</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.5</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.4</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-clover2-plugin</artifactId>
<configuration>
<licenseLocation>${clover.license}</licenseLocation>
<generateXml>true</generateXml>
<generateHtml>true</generateHtml>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<configuration>
<xmlOutput>true</xmlOutput>
<findbugsXmlOutput>true</findbugsXmlOutput>
<findbugsXmlWithMessages>true</findbugsXmlWithMessages>
</configuration>
</plugin>
<!-- checkstyle plugin. Execute 'mvn verify' and look for checkstyle-result.xml under target folder -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.9.1</version>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
<configuration>
<consoleOutput>true</consoleOutput>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
<configLocation>src/main/resources/checkstyle.xml</configLocation>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<inherited>false</inherited>
<configuration>
<rules>
<requireMavenVersion>
<version>[3.0.0,)</version>
</requireMavenVersion>
<requireJavaVersion>
<version>1.8</version>
</requireJavaVersion>
<requireOS>
<family>unix</family>
</requireOS>
</rules>
</configuration>
<executions>
<execution>
<id>clean</id>
<goals>
<goal>enforce</goal>
</goals>
<phase>pre-clean</phase>
</execution>
<execution>
<id>default</id>
<goals>
<goal>enforce</goal>
</goals>
<phase>validate</phase>
</execution>
<execution>
<id>site</id>
<goals>
<goal>enforce</goal>
</goals>
<phase>pre-site</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<forkMode>${oozie.test.forkMode}</forkMode>
<forkedProcessTimeoutInSeconds>${test.timeout}</forkedProcessTimeoutInSeconds>
<argLine>-Xmx1024m -da -XX:MaxPermSize=512m</argLine>
<systemPropertyVariables>
<oozie.test.db.host>${oozie.test.db.host}</oozie.test.db.host>
<oozie.test.config.file>${oozie.test.config.file}</oozie.test.config.file>
<oozie.data.dir>${oozie.data.dir}</oozie.data.dir>
</systemPropertyVariables>
<environmentVariables>
<HADOOP_HOME>dummy</HADOOP_HOME>
</environmentVariables>
<excludes>
<exclude>**/${test.exclude}.java</exclude>
<exclude>${test.exclude.pattern}</exclude>
<!-- Explictly use -Dtest=TestSshActionExecutor,TestSshActionExecutorExtension
to test the SSH action
-->
<exclude>**/TestSsh*.java</exclude>
<!-- See 'testSqoop' profile in core/pom.xml and the Building doc-->
<exclude>**/TestSqoop*.java</exclude>
<!-- Explictly use -Dtest=TestMapReduceActionExecutorUberJar to test the uber jar functionality.
Requires at least Hadoop 1.2.0 or 2.2.0.
-->
<exclude>**/TestMapReduceActionExecutorUberJar.java</exclude>
</excludes>
<!-- DO NOT CHANGE THIS VALUES, TESTCASES CANNOT RUN IN PARALLEL -->
<parallel>classes</parallel>
<threadCount>1</threadCount>
<perCoreThreadCount>1</perCoreThreadCount>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>src/main/assemblies/empty.xml</descriptor>
</descriptors>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.rat</groupId>
<artifactId>apache-rat-plugin</artifactId>
<configuration>
<excludeSubProjects>false</excludeSubProjects>
<excludes>
<exclude>**/*iml</exclude>
<exclude>release-log.txt</exclude>
<exclude>work.log</exclude>
<exclude>SecurityAuth.audit</exclude>
<exclude>.gitignore</exclude>
<exclude>docs/src/site/twiki/*.twiki</exclude>
<exclude>examples/src/main/data/*</exclude>
<exclude>core/src/test/resources/test-ioutils.txt</exclude>
<exclude>core/src/test/resources/PigMain.txt</exclude>
<exclude>webapp/src/main/resources/.gitignore</exclude>
<exclude>**/target/**</exclude>
<exclude>**/build/**</exclude>
<exclude>.git/**</exclude>
<exclude>test-patch/**</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
running with -X switch output
---------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.2.1:single (default-cli) on project oozie-hadoop: Execution default-cli of goal org.apache.maven.plugins:maven-assembly-plugin:2.2.1:single failed: For artifact {null:null:null:jar}: The groupId cannot be empty. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.2.1:single (default-cli) on project oozie-hadoop: Execution default-cli of goal org.apache.maven.plugins:maven-assembly-plugin:2.2.1:single failed: For artifact {null:null:null:jar}: The groupId cannot be empty.
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:224)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:355)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:216)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:160)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-cli of goal org.apache.maven.plugins:maven-assembly-plugin:2.2.1:single failed: For artifact {null:null:null:jar}: The groupId cannot be empty.
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:143)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
Caused by: org.apache.maven.artifact.InvalidArtifactRTException: For artifact {null:null:null:jar}: The groupId cannot be empty.
at org.apache.maven.artifact.DefaultArtifact.validateIdentity(DefaultArtifact.java:130)
at org.apache.maven.artifact.DefaultArtifact.<init>(DefaultArtifact.java:123)
at org.apache.maven.bridge.MavenRepositorySystem.XcreateArtifact(MavenRepositorySystem.java:700)
at org.apache.maven.bridge.MavenRepositorySystem.XcreateArtifact(MavenRepositorySystem.java:660)
at org.apache.maven.bridge.MavenRepositorySystem.XcreateArtifact(MavenRepositorySystem.java:654)
at org.apache.maven.bridge.MavenRepositorySystem.XcreateArtifact(MavenRepositorySystem.java:612)
at org.apache.maven.bridge.MavenRepositorySystem.createArtifact(MavenRepositorySystem.java:98)
at org.apache.maven.project.DefaultProjectBuilder.initProject(DefaultProjectBuilder.java:697)
at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:174)
at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:364)
at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:284)
at org.apache.maven.project.artifact.MavenMetadataSource.retrieveRelocatedProject(MavenMetadataSource.java:577)
at org.apache.maven.project.artifact.MavenMetadataSource.retrieve(MavenMetadataSource.java:190)
at org.apache.maven.repository.legacy.resolver.DefaultLegacyArtifactCollector.recurse(DefaultLegacyArtifactCollector.java:532)
at org.apache.maven.repository.legacy.resolver.DefaultLegacyArtifactCollector.collect(DefaultLegacyArtifactCollector.java:144)
at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:484)
at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolveWithExceptions(DefaultArtifactResolver.java:340)
at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolveTransitively(DefaultArtifactResolver.java:334)
at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolveTransitively(DefaultArtifactResolver.java:309)
at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolveTransitively(DefaultArtifactResolver.java:278)
at org.apache.maven.plugin.assembly.artifact.DefaultDependencyResolver.resolveTransitively(DefaultDependencyResolver.java:206)
at org.apache.maven.plugin.assembly.artifact.DefaultDependencyResolver.resolve(DefaultDependencyResolver.java:128)
at org.apache.maven.plugin.assembly.archive.DefaultAssemblyArchiver.createArchive(DefaultAssemblyArchiver.java:183)
at org.apache.maven.plugin.assembly.mojos.AbstractAssemblyMojo.execute(AbstractAssemblyMojo.java:413)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
... 20 more
[ERROR]
[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
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :oozie-hadoop
ERROR, Oozie distro creation failed
Seems like a legit Maven bug.
https://issues.apache.org/jira/browse/MASSEMBLY-841
Looks like a fix is in the latest build but not necessarily the latest release.
I encountered this when trying to build Luke.
https://github.com/DmitryKey/luke
As the ERROR line says:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.2.1:single (default-cli) on project oozie-hadoop: Execution default-cli of goal org.apache.maven.plugins:maven-assembly-plugin:2.2.1:single failed: For artifact {null:null:null:jar}: The groupId cannot be empty. -> [Help 1]
You just missed the groupId element in your maven-assembly-plugin declaration:
<groupId>org.apache.maven.plugins</groupId>
The full plugin declaration must be:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>src/main/assemblies/empty.xml</descriptor>
</descriptors>
</configuration>
</plugin>

maven and aspectj plugin - tests hang

I am using the aspectj-maven-plugin when trying to weave my aspect into my application. The problem I am seeing is that the compilation and weaving seems to run fine, but whenever it gets to the test phase it simply hangs. I have included a section from my pom.xml
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.3</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.6.7</version>
</dependency>
</dependencies>
This is the output I get:
[INFO] Compiling 7 source files to /home/***/target/classes
[INFO] [aspectj:compile {execution: default}]
[INFO] [resources:testResources {execution: default-testResources}]
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/***/src/test/resources
[INFO] [compiler:testCompile {execution: default-testCompile}]
[INFO] Compiling 5 source files to /home/***/target/test-classes
[INFO] [aspectj:test-compile {execution: default}]
[INFO] [surefire:test {execution: default-test}]
[INFO] Surefire report directory: /home/***/surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running com.example.MyTest
Has anyone else seen this behaviour / know how to fix it?
Putting this here in case someone did as I was doing. The reason the test was hanging was because of the aspect pointcut.
call(* *.*(..))
After this I had an advice that was called before the pointcut. However this creating a cyclic condition, and was hanging my tests. doh!

Resources