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

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.

Related

Maven release failing : A zip file cannot include itself

I am facing an issue while releasing a Maven project to nexus repository. I am doing this by Jenkins job. I am getting the error:
Failed to execute goal org.apache.maven.plugins:maven-source-plugin:3.0.1:jar (attach-sources) on project xyz: Error creating source archive: A zip file cannot include itself -> [Help 1]
I am using maven assembly plugin and external.atlassian.jgitflow:jgitflow-maven-plugin.
I have followed below article on StackOveflow : A zip file cannot include itself - Maven-assembly plugin
But this did not solve the problem. Below is how I am using the plugin
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.x</groupId>
<artifactId>y</artifactId>
<packaging>jar</packaging>
<version>2.0.0</version>
<name>myArtifact</name>
<url>http://maven.apache.org</url>
<distributionManagement>
<repository>
<id>myRepoId</id>
<url>http://my/repo/location/releases/</url>
</repository>
<snapshotRepository>
<id>mySnapshotRepoId</id>
<url>http://my/repo/location/snapshots/</url>
</snapshotRepository>
</distributionManagement>
<repositories>
<repository>
<id>myRepoId</id>
<url>http://my/repo/location/releases/</url>
</repository>
<repository>
<id>mySnapshotRepoId</id>
<url>http://my/snapshot/repo/location/snapshots/</url>
</repository>
</repositories>
<dependencies>
<!-- http://mvnrepository.com/artifact/commons-io/commons-io -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.6</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<profiles>
<profile>
<id>local</id>
<properties>
<build.profile.id>local</build.profile.id>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<profile>
<id>pre_prod</id>
<properties>
<build.profile.id>pre_prod</build.profile.id>
</properties>
</profile>
<profile>
<id>prod</id>
<properties>
<build.profile.id>prod</build.profile.id>
</properties>
</profile>
</profiles>
<build>
<testResources>
<testResource>
<directory>${project.build.directory}</directory>
</testResource>
</testResources>
<plugins>
<plugin>
<groupId>external.atlassian.jgitflow</groupId>
<artifactId>jgitflow-maven-plugin</artifactId>
<version>1.0-m5.1</version>
<configuration>
<enableSshAgent>true</enableSshAgent>
<allowUntracked>true</allowUntracked>
<allowSnapshots>true</allowSnapshots>
<autoVersionSubmodules>true</autoVersionSubmodules>
<pushFeatures>true</pushFeatures>
<pushReleases>true</pushReleases>
<pushHotfixes>true</pushHotfixes>
<noDeploy>false</noDeploy>
<scmCommentPrefix>TC-61</scmCommentPrefix>
<flowInitContext>
<developBranchName>development</developBranchName>
<versionTagPrefix>My-APP-</versionTagPrefix>
</flowInitContext>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-scm-plugin</artifactId>
<version>1.8.1</version>
<configuration>
<tag>Release-${project.artifactId}-${project.version}</tag>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.1</version>
<configuration>
<archive>
<manifest>
<mainClass>com.mains.MainClass</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id> <!-- this is used for inheritance merges -->
<phase>package</phase> <!-- bind to the packaging phase -->
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.7</version>
<executions>
<execution>
<id>copy-resources</id>
<!-- here the phase you need -->
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}</outputDirectory>
<encoding>UTF-8</encoding>
<resources>
<resource>
<directory>src/main/resources/config/${build.profile.id}</directory>
<filtering>true</filtering>
</resource>
<resource>
<directory>src/main/resources/velocities/html</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.2</version>
</plugin>
<!-- START: Maven Jacoco Plugin -->
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.9</version>
<executions>
<!-- Prepares the property pointing to the JaCoCo runtime agent which
is passed as VM argument when Maven the Surefire plugin is executed. -->
<execution>
<id>default-prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>jacoco-instrument</id>
<goals>
<goal>instrument</goal>
</goals>
</execution>
<execution>
<id>jacoco-restore-instrumented-classes</id>
<goals>
<goal>restore-instrumented-classes</goal>
</goals>
</execution>
<!-- Ensures that the code coverage report for unit tests is created
after unit tests have been run. -->
<execution>
<id>jacoco-report</id>
<phase>package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
<configuration>
<excludes>
<exclude>*</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<directory>${project.build.directory}</directory>
<filtering>false</filtering>
</resource>
</resources>
</build>
</project>
Can someone point me where I am making the mistake.
Thanks.

Include xml files in maven project

I have a maven pom file to build from a structure like:
package1
--1.java
--2.java
--packageMetaInfo.xml
package2
--21.java
--22.java
--packageMetaInfo.xml
When I do a maven compile, the xml files don't come in the target.
maven-compiler-plugin 3.5.1 - Unless I exclude the xmls through <exclusions>, I get an error that "Fatal error compiling: All compilation units must be of SOURCE kind ->"
maven-compiler-plugin 2.0.1 - compiles but skips the xmls
Is there a way I can have the xmls included in my jar. The structure would be
x.jar
package1
--1.class
--2.class
--packageMetaInfo.xml
package2
--21.class
--22.class
--packageMetaInfo.xml
*I understand it may not be maven standard to have xml with source files but I am working on a specific product and need to maintain this structure in both input and output.
<?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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.incent</groupId>
<artifactId>Release-4.3.0.1.0.0001</artifactId>
<name>AAA Custom code</name>
<version>2.4.0.1</version>
<properties>
<ormb.cmccb.path>./Active_Repository/CMCCB</ormb.cmccb.path>
<ormb.customcode.path>${ormb.cmccb.path}/data</ormb.customcode.path>
<ormb.release.name>AAA-4.3.0.1.0.0001</ormb.release.name>
<ormb.target.path>./target</ormb.target.path>
<ormb.output.path>Release-${ormb.release.name}/Application/${ormb.release.name}/CMCCB</ormb.output.path>
<ormb.serverfile.output.relpath>./target/server</ormb.serverfile.output.relpath>
<build.number>SNAPSHOT</build.number>
</properties>
<dependencies>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>5.0.3</version>
</dependency>
<dependency>
<groupId>antlr</groupId>
<artifactId>antlr</artifactId>
<version>2.7.7</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>icu4j</groupId>
<artifactId>icu4j</artifactId>
<version>49.1</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.6.1</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.2</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>wlfullclient</groupId>
<artifactId>wlfullclient</artifactId>
<version>10.3.4.0</version>
<type>jar</type>
</dependency>
</dependencies>
<build>
<sourceDirectory>${ormb.customcode.path}/java</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
<executions>
<execution>
<id>copy-cm</id>
<phase>install</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${ormb.customcode.path}/etc/lib</outputDirectory>
<overwrite>true</overwrite>
<resources>
<resource>
<directory>${ormb.target.path}</directory>
<includes>
<include>cm.jar</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>copy-mwpackage</id>
<phase>install</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${ormb.serverfile.output.relpath}</outputDirectory>
<overwrite>true</overwrite>
<resources>
<resource>
<directory>${ormb.target.path}</directory>
<includes>
<include>Release-${ormb.release.name}.zip</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<encoding>ISO-8859-1</encoding>
<source>1.7</source>
<target>1.7</target>
<includes>
<include>**/cm/**</include>
</includes>
<excludes>
<exclude>**/*.xml</exclude>
</excludes>
<resources>
<resource>
<directory>${ormb.customcode.path}/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>create-cm</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>Active_Repository/assembly/executable.xml</descriptor>
</descriptors>
<finalName>cm</finalName>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
<archive>
<manifestEntries>
<Specification-Title>${project.name}</Specification-Title>
<Specification-Version>${project.version}</Specification-Version>
<Implementation-Version>${build.number}</Implementation-Version>
</manifestEntries>
</archive>
</configuration>
</execution>
<execution>
<id>create-distro</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>Active_Repository/assembly/dist.xml</descriptor>
</descriptors>
<finalName>custom-action-dist</finalName>
<appendAssemblyId>false</appendAssemblyId>
<finalName>Release-${ormb.release.name}</finalName>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
I faced the same issue, I wanted to keep fxml & java files in the same folder (I'm using scenebuilder who needs both fxml and java files at the same place).
Here is my solution in pom.xml:
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.fxml</include>
</includes>
</resource>
</resources>
If you want the xml files to be included in your JAR file, then store them in the resources folder, instead of java.
Presumably they're in src/main/java. Try moving them to src/main/resources. Anything in src/main/resources will be packaged into the JAR file along with the .class files.

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>

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

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>

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