maven plsql build fails :: Failed to execute goal org.codehaus.mojo:sql-maven-plugin:1.3:execute (create-schema) on project my-utplsql-tests - maven

My maven build fails with below error::
Failed to execute goal org.codehaus.mojo:sql-maven-plugin:1.3:execute (create-schema) on project my-utplsql-tests: Execution create-schema of goal org.codehaus.mojo:sql-maven-plugin:1.3:execute failed: Plugin org.codehaus.mojo:sql-maven-plugin:1.3 or one of its dependencies could not be resolved: Failed to collect dependencies at org.codehaus.mojo:sql-maven-plugin:jar:1.3 -> com.oracle:ojd
bc6:jar:11.2.0:
Kindly help me.
My POM XML is as below.
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sql-maven-plugin</artifactId>
<version>1.3</version>
<dependencies>
<!-- specify the dependent jdbc driver here -->
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId>
<version>10.2.0.4.0</version>
</dependency>
</dependencies>
<!-- common configuration shared by all executions -->
<configuration>
<driver>oracle.jdbc.driver.OracleDriver</driver>
<url>jdbc:oracle:thin:#${db.host}:1521:${db.instance}</url>
<username>${db.username}</username>
<password>${db.password}</password>
<delimiter>/</delimiter>
<delimiterType>row</delimiterType>
<keepFormat>true</keepFormat>
</configuration>
<executions>
<execution>
<id>create-schema</id>
<phase>process-test-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<orderFile>ascending</orderFile>
<delimiter>;</delimiter>
<delimiterType>normal</delimiterType>
<onError>continue</onError>
<keepFormat>false</keepFormat>
<fileset>
<basedir>src/main/sql</basedir>
<includes>
<include>**/*.sql</include>
</includes>
</fileset>
</configuration>
</execution>
<execution>
<id>create-plsql-packages</id>
<phase>process-test-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<orderFile>ascending</orderFile>
<fileset>
<basedir>src/main/plsql</basedir>
<includes>
<include>**/*.pks</include>
<include>**/*.pkb</include>
<include>**/*.sf</include>
</includes>
</fileset>
</configuration>
</execution>
<execution>
<id>insert-data</id>
<phase>process-test-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<orderFile>ascending</orderFile>
<delimiter>;</delimiter>
<delimiterType>normal</delimiterType>
<onError>continue</onError>
<keepFormat>false</keepFormat>
<fileset>
<basedir>src/main/resources/data</basedir>
<includes>
<include>**/*.sql</include>
</includes>
</fileset>
</configuration>
</execution>
<execution>
<id>create-plsql-test-packages</id>
<phase>process-test-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<orderFile>ascending</orderFile>
<fileset>
<basedir>src/test/plsql</basedir>
<includes>
<include>**/*.pks</include>
<include>**/*.pkb</include>
<include>**/*.sf</include>
<include>**/*.sp</include>
</includes>
</fileset>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.theserverlabs.maven.utplsql</groupId>
<artifactId>maven-utplsql-plugin</artifactId>
<version>1.31</version>
<dependencies>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId>
<version>10.2.0.4.0</version>
</dependency>
</dependencies>
<configuration>
<driver>oracle.jdbc.driver.OracleDriver</driver>
<url>jdbc:oracle:thin:#${db.host}:1521:${db.instance}</url>
<username>${db.username}</username>
<password>${db.password}</password>
<!--<packageName>betwnstr</packageName>-->
<testSuiteName>All</testSuiteName>
</configuration>
<executions>
<execution>
<id>run-plsql-test-packages</id>
<phase>process-test-resources</phase>
<goals>
<goal>execute</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

Related

Can not resolve ${project.parent.version} to download dependency

i am using/tried with following versions:
Intellij 2022.3.3 and the prev. one.
Maven 3.8.5, 3.8.4, 3.8.1
I also tried following envs:
Maven-Tool integrated into IntelliJ
IntelliJ terminal
OS terminal
And i always get this error:
[WARNING] The POM for io.swagger:swagger-annotations:jar:${project.parent.version} is missing, no dependency information available
Could not find artifact io.swagger:swagger-annotations:pom:${project.parent.version} in mirror-maven.
[INFO]
[INFO] --- openapi-generator-maven-plugin:5.1.0:generate (generate) # XXX-parent-application ---
[WARNING] The POM for io.swagger.core.v3:swagger-annotations:jar:${project.parent.version} is missing, no dependency information available
[WARNING] The POM for io.swagger.core.v3:swagger-models:jar:${project.parent.version} is missing, no dependency information available
[WARNING] The POM for io.swagger.parser.v3:swagger-parser-v2-converter:jar:${project.parent.version} is missing, no dependency information available
[WARNING] The POM for io.swagger.parser.v3:swagger-parser-v3:jar:${project.parent.version} is missing, no dependency information available
[WARNING] The POM for org.openapitools:openapi-generator-core:jar:${project.parent.version} is missing, no dependency information available
[INFO] --- swagger-maven-plugin:3.1.8:generate (default) # XXX-projectname ---
[WARNING] The POM for io.swagger:swagger-annotations:jar:${project.parent.version} is missing, no dependency information available
[WARNING] The POM for io.swagger:swagger-core:jar:${project.parent.version} is missing, no dependency information available
[WARNING] The POM for io.swagger:swagger-jaxrs:jar:${project.parent.version} is missing, no dependency information available
URL_TO_MY_CENTRAL_REPO/io/swagger/core/v3/swagger-annotations/$%7Bproject.parent.version%7D/swagger-annotations-$%7Bproject.parent.version%7D.pom
I am the only one in my team who has this issue, we checked a lot of stuff:
delete maven-repo-folder
check maven-configuration in intellij and settings.xml
insert a static version (but it does not overwrite ${project.parent.version}
yes, it does exist on our artifactory-server
fresh pull from github
So, my question is, where can i find this used property, because i cant find it anywhere in the project.
Update:
added pom
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>PARENT</artifactId>
<groupId>GROUP_ID_APP</groupId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<modules>
<module>application-a</module>
<module>application-b</module>
<module>application-c</module>
<module>application-d</module>
</modules>
<artifactId>PARENT-application</artifactId>
<packaging>pom</packaging>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<!--Properties for swagger generating-->
<swaggerJsonDir>${basedir}/target/generated</swaggerJsonDir>
<swaggerJsonVersion>${project.version}</swaggerJsonVersion>
<swaggerLocation>Override in child project</swaggerLocation>
<swaggerTitle>Override in child project</swaggerTitle>
<!--Override in child project with "compile"-->
<swaggerPhase>none</swaggerPhase>
<!--Properties for client generation-->
<client-generation-application-package>Override in child project</client-generation-application-package>
<sonar.exclusions>
**/foldername/**/*_generated/**/*.java
</sonar.exclusions>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<!-- Testing -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- START: added this part below to check if this may solve my problem -->
<!-- <dependency>-->
<!-- <groupId>io.swagger</groupId>-->
<!-- <artifactId>swagger-core</artifactId>-->
<!-- <version>1.6.5</version>-->
<!-- </dependency>-->
<!-- 2.1.23 -->
<!-- https://mvnrepository.com/artifact/io.swagger.core.v3/swagger-models -->
<!-- <dependency>-->
<!-- <groupId>io.swagger.core.v3</groupId>-->
<!-- <artifactId>swagger-models</artifactId>-->
<!-- <version>2.1.13</version>-->
<!-- </dependency>-->
<dependency>
<groupId>io.swagger.parser.v3</groupId>
<artifactId>swagger-parser</artifactId>
<version>2.0.30</version>
</dependency>
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>5.4.0</version>
</dependency>
<!-- END: added this part above to check if this may solve my problem -->
</dependencies>
<build>
<plugins>
<!--Build executable jar from spring application.-->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<executable>true</executable>
</configuration>
</plugin>
<!--Generate swagger.json-->
<plugin>
<groupId>com.github.kongchen</groupId>
<artifactId>swagger-maven-plugin</artifactId>
<version>3.1.8</version>
<configuration>
<apiSources>
<apiSource>
<springmvc>true</springmvc>
<locations>
<location>${swaggerLocation}</location>
</locations>
<info>
<title>${swaggerTitle}</title>
<version>${swaggerJsonVersion}</version>
</info>
<outputFormats>json</outputFormats>
<swaggerDirectory>${swaggerJsonDir}</swaggerDirectory>
</apiSource>
</apiSources>
</configuration>
<executions>
<execution>
<phase>${swaggerPhase}</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>generate-application-b-client</id>
<properties>
<maven.test.skip>true</maven.test.skip>
<input>${project.basedir}/../application-b/target/generated/swagger.json</input>
<targetDirectory>${project.basedir}/target/application-b</targetDirectory>
<modelPackage>GROUP_ID_APP.${client-generation-application-package}.application_b_generated.model</modelPackage>
<apiPackage>GROUP_ID_APP.${client-generation-application-package}.application_b_generated.service.client</apiPackage>
<sourceDirectory>src/main/javapackagefoldername/${client-generation-application-package}</sourceDirectory>
<modelDirectory>${sourceDirectory}/application_b_generated/model</modelDirectory>
<apiDirectory>${sourceDirectory}/application_b_generated/service</apiDirectory>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>5.1.0</version>
<executions>
<execution>
<id>generate</id>
<phase>integration-test</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${input}</inputSpec>
<output>${targetDirectory}</output>
<skipValidateSpec>true</skipValidateSpec>
<generatorName>java</generatorName>
<modelPackage>${modelPackage}</modelPackage>
<apiPackage>${apiPackage}</apiPackage>
<typeMappings>
<typeMapping>OffsetDateTime=LocalDateTime</typeMapping>
</typeMappings>
<importMappings>
<importMapping>java.time.OffsetDateTime=java.time.LocalDateTime</importMapping>
</importMappings>
<configOptions>
<modelPackage>${modelPackage}</modelPackage>
<apiPackage>${apiPackage}</apiPackage>
<dateLibrary>java8</dateLibrary>
<java8>true</java8>
<library>resttemplate</library>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
<executions>
<execution>
<id>copy-models</id>
<phase>integration-test</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${modelDirectory}</outputDirectory>
<overwrite>true</overwrite>
<resources>
<resource>
<directory>${targetDirectory}/${modelDirectory}</directory>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>copy-services</id>
<phase>integration-test</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${apiDirectory}</outputDirectory>
<overwrite>true</overwrite>
<resources>
<resource>
<directory>${targetDirectory}/${apiDirectory}</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<id>clean-old</id>
<phase>compile</phase>
<goals>
<goal>clean</goal>
</goals>
<configuration>
<excludeDefaultDirectories>true</excludeDefaultDirectories>
<filesets>
<fileset>
<directory>${modelDirectory}</directory>
</fileset>
<fileset>
<directory>${apiDirectory}</directory>
</fileset>
</filesets>
</configuration>
</execution>
<execution>
<id>auto-clean</id>
<phase>integration-test</phase>
<goals>
<goal>clean</goal>
</goals>
<configuration>
<excludeDefaultDirectories>true</excludeDefaultDirectories>
<filesets>
<fileset>
<directory>${targetDirectory}</directory>
</fileset>
</filesets>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>generate-application-a-client</id>
<properties>
<maven.test.skip>true</maven.test.skip>
<input>${project.basedir}/../application-a/target/generated/swagger.json</input>
<targetDirectory>${project.basedir}/target/application-a</targetDirectory>
<modelPackage>GROUP_ID_APP.${client-generation-application-package}.application_a_generated.model</modelPackage>
<apiPackage>GROUP_ID_APP.${client-generation-application-package}.application_a_generated.service.client</apiPackage>
<sourceDirectory>src/main/javapackagefoldername/${client-generation-application-package}</sourceDirectory>
<modelDirectory>${sourceDirectory}/application_a_generated/model</modelDirectory>
<apiDirectory>${sourceDirectory}/application_a_generated/service</apiDirectory>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>5.1.0</version>
<executions>
<execution>
<id>generate</id>
<phase>integration-test</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${input}</inputSpec>
<output>${targetDirectory}</output>
<skipValidateSpec>true</skipValidateSpec>
<generatorName>java</generatorName>
<modelPackage>${modelPackage}</modelPackage>
<apiPackage>${apiPackage}</apiPackage>
<typeMappings>
<typeMapping>OffsetDateTime=LocalDateTime</typeMapping>
</typeMappings>
<importMappings>
<importMapping>java.time.OffsetDateTime=java.time.LocalDateTime</importMapping>
</importMappings>
<configOptions>
<modelPackage>${modelPackage}</modelPackage>
<apiPackage>${apiPackage}</apiPackage>
<dateLibrary>java8</dateLibrary>
<java8>true</java8>
<library>resttemplate</library>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
<executions>
<execution>
<id>copy-models</id>
<phase>integration-test</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${modelDirectory}</outputDirectory>
<overwrite>true</overwrite>
<resources>
<resource>
<directory>${targetDirectory}/${modelDirectory}</directory>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>copy-services</id>
<phase>integration-test</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${apiDirectory}</outputDirectory>
<overwrite>true</overwrite>
<resources>
<resource>
<directory>${targetDirectory}/${apiDirectory}</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<id>clean-old</id>
<phase>compile</phase>
<goals>
<goal>clean</goal>
</goals>
<configuration>
<excludeDefaultDirectories>true</excludeDefaultDirectories>
<filesets>
<fileset>
<directory>${modelDirectory}</directory>
</fileset>
<fileset>
<directory>${apiDirectory}</directory>
</fileset>
</filesets>
</configuration>
</execution>
<execution>
<id>auto-clean</id>
<phase>integration-test</phase>
<goals>
<goal>clean</goal>
</goals>
<configuration>
<excludeDefaultDirectories>true</excludeDefaultDirectories>
<filesets>
<fileset>
<directory>${targetDirectory}</directory>
</fileset>
</filesets>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Maven often doesn't resolve version number for transitive dependencies - "${project.version}"
ill post my solution there.

Clover failing with "No Clover database found, skipping report generation"

I'm trying to add Clover to my maven (groovy) project in order to get some code coverage results. However it fails to generate the code coverage report.
The report is just empty.
My src files are located in src/main/groovy and my tests are located in src/test/groovy
When I run:
mvn clean clover:setup test clover:instrument clover:aggregate clover:clover
Build log:
[INFO] No Clover instrumentation done on source files in: [/home/xxx/workspace/yyy/src/main/java, /home/xxx/workspace/yyy/target/generated-sources/groovy-stubs/main] as no matching sources files found (JAVA_LANGUAGE)
[INFO] No Clover instrumentation done on source files in: [/home/xxx/workspace/yyy/src/test/java, /home/xxx/workspace/yyy/src/test/groovy] as no matching sources files found (JAVA_LANGUAGE)
...
[WARNING] No Clover database found, skipping report generation
[INFO] No report being generated for this module.
...
And indeed if I look in my tree for any database file,
My pom.xml:
....
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.0.1</version>
<executions>
<execution>
<id>enforce-versions</id>
<goals>
<goal>enforce</goal>
</goals>
</execution>
</executions>
<configuration>
<rules>
<AlwaysPass />
</rules>
<fail>true</fail>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
<executions>
<execution>
<id>copy-test-resources</id>
<phase>validate</phase>
<goals>
<goal>testResources</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>${project.basedir}</directory>
<filtering>true</filtering>
<includes>
<include>src/**/*.*</include>
<include>vars/**/*.*</include>
<include>resources/**/*.*</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<!-- clover -->
<plugin>
<groupId>org.openclover</groupId>
<artifactId>clover-maven-plugin</artifactId>
<version>4.2.0</version>
</plugin>
<!-- Tests -->
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<goals>
<goal>addSources</goal>
<goal>addTestSources</goal>
<goal>generateStubs</goal>
<goal>compile</goal>
<goal>generateTestStubs</goal>
<goal>compileTests</goal>
</goals>
</execution>
</executions>
<configuration>
<sources>
<source>
<directory>${project.basedir}/src</directory>
<includes>
<include>**/*.groovy</include>
</includes>
</source>
</sources>
<testSources>
<source>
<directory>${project.basedir}/src/test/groovy</directory>
<includes>
<include>**/*.groovy</include>
</includes>
</source>
</testSources>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20</version>
<configuration>
<failIfNoTests>true</failIfNoTests>
<includes>
<include>**/*</include>
</includes>
</configuration>
<executions>
<execution>
<id>test</id>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.openclover</groupId>
<artifactId>clover-maven-plugin</artifactId>
<version>4.2.0</version>
</plugin>
</plugins>
</reporting>
</project>

combination of shade, proguard and appassembler maven plugins

I'm trying to build and obfuscate a multi module project using maven. I use the shade plugin to create a fat jar containing all of my own class files(every module) so that I could obfuscate the fat jar using proguard-maven-plugin and then create executable build output using appassembler plugin. everything works except that the other module dependencies also appear in the appassembler repo dir, which is wrong because the obfuscated classes already exist in the shaded jar.
I've tried defining the other module dependencies as provided and then adding the dependencies for the shade plugin, but the shade plugin seems to ignore them.
this is the relevant part of pom.xml:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<outputFile>${project.build.directory}/${project.build.finalName}-shaded.${project.packaging}</outputFile>
<artifactSet>
<includes>
<include>${project.groupId}:*</include>
</includes>
</artifactSet>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>module-a</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>module-b</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>com.github.wvengen</groupId>
<artifactId>proguard-maven-plugin</artifactId>
<version>2.0.13</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>proguard</goal>
</goals>
</execution>
</executions>
<configuration>
<injar>${project.build.finalName}-shaded.${project.packaging}</injar>
<outjar>${project.build.finalName}.${project.packaging}</outjar>
<proguardInclude>proguard.pro</proguardInclude>
<maxMemory>1024m</maxMemory>
<libs>
<lib>${java.home}/lib/rt.jar</lib>
<lib>${java.home}/lib/jce.jar</lib>
</libs>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>appassembler-maven-plugin</artifactId>
<version>2.0.0</version>
<executions>
<execution>
<id>assemble</id>
<phase>package</phase>
<goals>
<goal>assemble</goal>
</goals>
<configuration>
<programs>
<program>
<mainClass>my.package.Application</mainClass>
</program>
</programs>
<useWildcardClassPath>true</useWildcardClassPath>
<repositoryLayout>flat</repositoryLayout>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Any ideas are welcome.
I found a solution which is not as convenient as I'd like but its better than removing the other module jars manually. I used assembly plugin to exclude the jars from the build distribution zip.
pom.xml:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<outputFile>${project.build.directory}/${project.build.finalName}-shaded.${project.packaging}</outputFile>
<artifactSet>
<includes>
<include>${project.groupId}:*</include>
</includes>
</artifactSet>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.github.wvengen</groupId>
<artifactId>proguard-maven-plugin</artifactId>
<version>2.0.13</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>proguard</goal>
</goals>
</execution>
</executions>
<configuration>
<injar>${project.build.finalName}-shaded.${project.packaging}</injar>
<outjar>${project.build.finalName}.${project.packaging}</outjar>
<proguardInclude>proguard.pro</proguardInclude>
<maxMemory>1024m</maxMemory>
<libs>
<lib>${java.home}/lib/rt.jar</lib>
<lib>${java.home}/lib/jce.jar</lib>
</libs>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>appassembler-maven-plugin</artifactId>
<version>2.0.0</version>
<executions>
<execution>
<id>assemble</id>
<phase>package</phase>
<goals>
<goal>assemble</goal>
</goals>
<configuration>
<programs>
<program>
<mainClass>my.package.Application</mainClass>
</program>
</programs>
<useWildcardClassPath>true</useWildcardClassPath>
<repositoryLayout>flat</repositoryLayout>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>descriptor.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
descriptor.xml:
<assembly xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
<id>distribution</id>
<formats>
<format>zip</format>
</formats>
<fileSets>
<fileSet>
<directory>${project.build.directory}/appassembler</directory>
<excludes>
<exclude>**/module-a-${project.version}.${project.packaging}</exclude>
<exclude>**/module-b-${project.version}.${project.packaging}</exclude>
</excludes>
<outputDirectory>/</outputDirectory>
</fileSet>
</fileSets>
I think your issue comes from the fact that the shaded jar and the appassembler are ran during the same phase, package.
I think you should try to modify the phase of the appassembler plugin to:
<phase>post-package</phase>

Problems running Maven Failsafe Plugin

I'm having trouble running failsafe plugin using mvn verify
Basically it doesn't run the integration tests! If I run mvn failsafe:integration-test works ok
Also, do I need jetty plugin or similar for running integration tests.
The failsafe tasks are not bound to verify task
Code has been checked in to..
https://github.com/tonymurphy/builder
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>junit-stuff</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<version>2.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.19.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
<testResources>
<testResource>
<directory>src/test/resources</directory>
</testResource>
</testResources>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19</version>
<executions>
<execution>
<id>default-test</id>
<phase>none</phase>
</execution>
<execution>
<id>unit-test</id>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<includes>
<include>**/*.java</include>
</includes>
<excludes>
<exclude>**/*$*</exclude>
<exclude>**/*ContractTest.java</exclude>
<exclude>**/*MvcTest.java</exclude>
<exclude>**/*_Test.java</exclude>
</excludes>
<excludedGroups>com.example.OneAtATime</excludedGroups>
</configuration>
</execution>
<execution>
<id>mvc-tests</id>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<includes>
<include>**/*MvcTest.java</include>
</includes>
<excludedGroups>com.example.OneAtATime</excludedGroups>
<excludes>
<exclude>**/*$*</exclude>
<exclude>**/*ContractTest.java</exclude>
<exclude>**/*_Test.java</exclude>
</excludes>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.19.1</version>
<executions>
<execution>
<id>integration-test</id>
<configuration>
<groups>com.example.OneAtATime</groups>
</configuration>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.2.2.v20140723</version>
<configuration>
<scanIntervalSeconds>10</scanIntervalSeconds>
<stopPort>8005</stopPort>
<stopKey>STOP</stopKey>
</configuration>
<executions>
<execution>
<id>start-jetty</id>
<phase>pre-integration-test</phase>
<goals>
<!-- stop any previous instance to free up the port -->
<goal>stop</goal>
<goal>start</goal>
</goals>
<configuration>
<scanIntervalSeconds>0</scanIntervalSeconds>
<daemon>true</daemon>
</configuration>
</execution>
<execution>
<id>stop-jetty</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<version>2.5</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.19.1</version>
<reportSets>
<reportSet>
<id>integration-tests</id>
<reports>
<report>failsafe-report-only</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>
</project>
You need to create a separate execution for the verify goal:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
...
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
<execution>
<id>verify</id>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>

multiple assemble results

I need to keep a status created during an artifact proceeding. So I've got the idea to bundle these state into an own zip and unpacking it in the prepare phase. Additional shall be the real result deployed as well. This result is a bundle to created files, valuable within a next artifact.
I'm trying create two result zips, but during deploy the second assembly name is ignored and always myArtifact-version.zip is deployed.
Whats wrong?
Thanks in advance,
Sven
my pom looks like:
<project ...>
<artifactId>myArtifact</artifactId>
<groupId>de.myGroup</groupId>
<packaging>pom</packaging>
...
<dependencies>
<dependency>
<groupId>de.myGroup</groupId>
<artifactId>gen-status</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<build>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/config</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
... proceeding generation
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>results</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/assemble/bundle-gen-results.xml</descriptor>
</descriptors>
</configuration>
</execution>
<execution>
<id>status</id>
<phase>package</phase>
<goals><goal>single</goal></goals>
<configuration>
<descriptors>
<descriptor>src/assemble/bundle-gen-status.xml</descriptor>
</descriptors>
<finalName>gen-status-${project.version}</finalName>
</configuration>
</execution>
</executions>
</plugin>
</build>
</project>
The assemblies are:
gen-results.xml:
<assembly ... >
<id></id>
<formats><format>zip</format></formats>
<baseDirectory></baseDirectory>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>${project.build.directory}/export</directory>
<includes>
<include>something.*/**/*.*</include>
</includes>
</fileSet>
</fileSets>
</assembly>
bundle-gen-status.xml
<assembly ... >
<id></id>
<formats><format>zip</format></formats>
<baseDirectory></baseDirectory>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>${project.build.directory}/config</directory>
<includes>
<include>status.file</include>
</includes>
<outputDirectory>classes/scripts</outputDirectory>
</fileSet>
</fileSets>
</assembly>
You can use the attach-artifact goal of build helper maven plugin to achieve this.
This allows me attaching the status file only to the current artifact. But then I'm getting a dependency cycle, when trying to add the status artifact.
<project ...>
<artifactId>myArtifact</artifactId>
<groupId>de.myGroup</groupId>
<packaging>pom</packaging>
...
<dependencies>
<dependency>
<groupId>de.myGroup</groupId>
<artifactId>myArtifact</artifactId>
<classifier>status</classifier>
<version>${project.version}</version>
</dependency>
</dependencies>
...
<build>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/config</outputDirectory>
<includeClassifiers>status</includeClassifiers>
</configuration>
</execution>
</executions>
</plugin>
...
exec
...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>status</id>
<phase>package</phase>
<goals><goal>attach-artifact</goal></goals>
<configuration>
<artifacts>
<artifact>
<file>${project.build.directory}/config/status.file</file>
<type>file</type>
<classifier>status</classifier>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>

Resources