Multiple commands with Maven Exec plugin - maven

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

Related

Not able to run skip Cucumber tests on tags on command line. getting must specify a valid lifecycle phase or a goal in the format <plugin-prefix >

Any help on what should i do to run the command line for skipping Cucumber tags? i have tried various ways (https://www.programsbuzz.com/article/cucumber-skip-test-command-line)but each way i get the below error for the mvn command. Would i need to configure anything for cucumber to run the -Dcucumber.options flag? please help
XX#DESKTOP-R87G978 MINGW64 ~/Downloads/sample/task (main)
$ mvn -Dcucumber.options="--tags '#smoke'"
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.367 s
[INFO] Finished at: 2022-11-06T13:25:53Z
[INFO] ------------------------------------------------------------------------
[ERROR] No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [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/NoGoalSpecifiedException
This is my Pom.xml for build configuration
<build>
<testSourceDirectory>${project.basedir}/src/test/java/com/example/demo</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M7</version>
<configuration>
<includes>
<include>**/*Test*.java</include>
</includes>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
<executions>
<execution>
<id>jacoco-initialize</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>jacoco-site</id>
<phase>package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>production</id>
<build>
<plugins>
<plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<version>${vaadin.version}</version>
<executions>
<execution>
<id>frontend</id>
<phase>compile</phase>
<goals>
<goal>prepare-frontend</goal>
<goal>build-frontend</goal>
</goals>
<configuration>
<productionMode>true</productionMode>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
The error message is pretty much self explanatory. While you have specified the option indeed you forgot to set the goal or a phase which are actually and instruction for the maven for what to do.
Like
mvn -Dcucumber.options="--tags '#smoke'" test where test is the phase.

maven - why is dependency check skipped?

In my pom plugins I have...
<plugin>
<groupId>org.owasp</groupId>
<artifactId>dependency-check-maven</artifactId>
<version>6.2.2</version>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
But when I run mvn dependency-check:check or mvn verify in the logs I see
[INFO] --- dependency-check-maven:6.2.2:check (default-cli) # my-project ---
[INFO] Skipping dependency-check
How do I get it to run??
Turned out the dependency-check.skip was evaluating to true in the properties.
I simply set it to false.

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 Shade Plugin not attaching shaded artifact

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>

maven-failsafe-plugin Errors and BUILD SUCCESS?

my question is very similar to this one: maven-failsafe-plugin Failures and BUILD SUCCESS?
and I manage to set up failsafe plugin to fail if tests fail.
But if test goes into error state, failsafe plugin still does not break the build.
.................
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running xxxxx.IntegrationTierFunctionalTestCase
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.054 sec <<< FAILURE!
Results :
Tests in error:
testException(xxxxx.IntegrationTierFunctionalTestCas
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is
[INFO] [failsafe:verify {execution: functional-test-1024}]
[INFO] Failsafe report directory: C:\projects\oec-integration-server\trunk\oec-integrati
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is
[INFO] [failsafe:integration-test {execution: functional-test-24}]
[INFO] Failsafe report directory: C:\projects\oec-integration-server\trunk\oec-integrati
.............
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 58 seconds
[INFO] Finished at: Tue May 28 17:48:13 BST 2013
[INFO] Final Memory: 114M/781M
[INFO] ------------------------------------------------------------------------
for simplicy IntegrationTierFunctionalTestCase contains only this code
import org.junit.Test;
import static org.junit.Assert.fail;
public class IntegrationTierFunctionalTestCase
{
#Test
public void testException(){
//fail();
throw new RuntimeException("super error");
}
}
if I uncomment fail() whole build fails correctly, with build failed.
but if I just throw an exception, it fails as on shown above.
oour plugin configuration looks like this
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.7</version>
<configuration>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<systemPropertyVariables>
<oec.env>TEST</oec.env>
<mule.test.timeoutSecs>2400</mule.test.timeoutSecs>
</systemPropertyVariables>
<additionalClasspathElements>
<additionalClasspathElement>${basedir}/src/main/resources/config</additionalClasspathElement>
</additionalClasspathElement>
</additionalClasspathElements>
</configuration>
<executions>
<execution>
<id>functional-test-1024</id>
<phase>test</phase>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<includes>
<include>**/IntegrationTierFunctionalTestCase.java</include>
</includes>
<forkMode>once</forkMode>
<argLine>-XX:MaxPermSize=256M -Xmx1024M</argLine>
</configuration>
</execution>
</executions>
</plugin>
What am I missing?
And no I do not want to wrap it in try-catch blocks and fail tests manually.
You need having two executions blocks, cause the verify goal of the maven-failsafe-plugin is intended to check the results of the integration tests.
<executions>
<execution>
<id>functional-test-1024</id>
<phase>test</phase>
<goals>
<goal>integration-test</goal>
</goals>
<configuration>
<includes>
<include>**/IntegrationTierFunctionalTestCase.java</include>
</includes>
<forkMode>once</forkMode>
<argLine>-XX:MaxPermSize=256M -Xmx1024M</argLine>
</configuration>
</execution>
<execution>
<id>verify</id>
<phase>verify</phase>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
Furthermore you should update the version of the maven-failsafe-plugin to 2.14.1 instead of 2.7.
Update: In the meantime update to 2.17.
If you're running the integration tests like this:
mvn test-compile failsafe:integration-test
Then you should know that according to the maven documentation on failsafe:
The Failsafe Plugin will not fail the build during the integration-test phase, thus enabling the post-integration-test phase to execute.
I was able to get the build to fail like this:
mvn test-compile failsafe:integration-test failsafe:verify
And here's my failsafe configuration for reference:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.19</version>
<configuration>
<includes>
<include>**/*IT.java</include>
</includes>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
</executions>
</plugin>
Please verify that the maven property "maven.test.failure.ignore" is not set to "true" in any of your maven pom.xml files, as it can be the only reason to not stop the build after test failure.
There is one possible additional reason why it happens. Failsafe verify is looking for test classes and expects them to be in ${project.build.directory}/test-classes - if you have a different setup it will just print "No tests to run." and ends if build success regardless of what the result of integration-test phase was.
You have to set testClassesDirectory in plugin configuration :
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<systemPropertyVariables>
<environmentType>${environmentType}</environmentType>
</systemPropertyVariables>
<summaryFile>${project.build.directory}/failsafe-reports/failsafe-summary.xml</summaryFile>
<testClassesDirectory>${project.build.directory}/classes</testClassesDirectory>
<suiteXmlFiles>
<suiteXmlFile>${suiteXml}</suiteXmlFile>
</suiteXmlFiles>
</configuration>

Resources