Missing Signature jar.asc for jar when post to Maven Central - java

It is the first time I am trying to deploy to Maven Central repo and I cannot find an ultimate guide on how to do it.
No matter what I tried I get the same error:
Missing Signature:
'/com/github/chameleontartu/amazon-mws-reports-maven/1.2.0-RC12/amazon-mws-reports-maven-1.2.0-RC12-javadoc.jar.asc' does not exist for 'amazon-mws-reports-maven-1.2.0-RC12-javadoc.jar'.
My open-source project with all code: Github repo.
GitHub Actions workflow .github/workflows/deploy.yml
name: Publish package to the Maven Central Repository
on:
release:
types: [created]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout#v2
- name: Set up Maven Central Repository
uses: actions/setup-java#v1
with:
java-version: 1.8
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Create Key File
run: echo "$GPG_PRIVATE_KEY" > private.key
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
- name: Import GPG Key
run: gpg --import --batch private.key
- name: Cache
uses: actions/cache#v1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- if: github.event.release
name: Update version in pom.xml (Release only)
run: mvn -B versions:set -DnewVersion=${{ github.event.release.tag_name }} -DgenerateBackupPoms=false
- name: Run Maven
run: mvn -B clean install
- name: Publish package
run: |-
mvn -B deploy -Dgpg.passphrase="$GPG_PASSPHRASE"
env:
GPG_KEYNAME: ${{ secrets.GPG_KEYNAME }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
# Examples are taken from
# - https://github.com/camunda/camunda-bpm-mockito/blob/465b4f5f2f29806a1a855e7cabf918b633df1075/.github/workflows/deploy.yml
# - https://github.com/see-es-vee/see-es-vee/blob/43bec4ef0005caa9b30cf11bf10efe03bd517733/.github/workflows/mavenpublish.yml
My pom.xml file with all plugins and dependencies:
<?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.github.chameleontartu</groupId>
<artifactId>amazon-mws-reports-maven</artifactId>
<version>1.1.0</version>
<packaging>jar</packaging>
<name>Amazon MWS :: Reports</name>
<description>Amazon MWS Reports API Client Library</description>
<url>https://github.com/ChameleonTartu/amazon-mws-reports-maven</url>
<licenses>
<license>
<name>The Apache License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<developers>
<developer>
<id>chameleontartu</id>
<name>Dmytro Chasovskyi</name>
<email>lal#mail.com</email>
<url>https://example.com</url>
<roles>
<role>developer</role>
</roles>
</developer>
<developer>
<id>amazon-mws</id>
<organization>Amazon Technologies, Inc</organization>
<organizationUrl>https://developer.amazonservices.com/gp/mws/docs.html</organizationUrl>
<roles>
<role>developer</role>
</roles>
</developer>
</developers>
<scm>
<connection>scm:git:git#github.com:ChameleonTartu/amazon-mws-reports-maven.git</connection>
<developerConnection>scm:git:git#github.com:ChameleonTartu/amazon-mws-orders-maven.git</developerConnection>
<url>https://github.com/ChameleonTartu/amazon-mws-reports-maven/tree/master</url>
</scm>
<properties>
<gpg.keyname>${ env.GPG_KEYNAME }</gpg.keyname>
<gpg.passphrase>${ env.GPG_PASSPHRASE }</gpg.passphrase>
<!-- Unify the encoding for all modules -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<jdk.version>1.6</jdk.version>
<compiler.fork>1.6</compiler.fork>
<!-- Dependencies -->
<maven-bundle-version>2.3.7</maven-bundle-version>
<commons-codec-version>1.14</commons-codec-version>
<commons-httpclient-version>3.1</commons-httpclient-version>
<commons-logging-version>1.1</commons-logging-version>
<httpcore.version>4.4.13</httpcore.version>
<httpclient.version>4.5.12</httpclient.version>
<mockito-version>1.9.5</mockito-version>
<junit-version>4.13</junit-version>
<jaxb-api.version>2.3.1</jaxb-api.version>
<!-- Plugins -->
<maven-eclipse-plugin.version>2.10</maven-eclipse-plugin.version>
<maven-idea-plugin.version>2.2.1</maven-idea-plugin.version>
<maven-bundle-plugin.version>5.1.1</maven-bundle-plugin.version>
<maven-assembly-plugin.version>3.3.0</maven-assembly-plugin.version>
<maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
<build-helper-maven-plugin.version>3.2.0</build-helper-maven-plugin.version>
<maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
<maven-javadoc-plugin.version>3.2.0</maven-javadoc-plugin.version>
<maven-install-plugin.version>2.5.2</maven-install-plugin.version>
<maven-scm-provider-gitexe.version>1.11.2</maven-scm-provider-gitexe.version>
<nexus-staging-maven-plugin.version>1.6.8</nexus-staging-maven-plugin.version>
<maven-source-plugin.version>3.2.1</maven-source-plugin.version>
<maven-release-plugin.version>2.5.3</maven-release-plugin.version>
<maven-deploy-plugin.version>2.8.2</maven-deploy-plugin.version>
</properties>
<dependencies>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>${commons-codec-version}</version>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>${commons-httpclient-version}</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging-api</artifactId>
<version>${commons-logging-version}</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>${httpclient.version}</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>${httpcore.version}</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>${mockito-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>${jaxb-api.version}</version>
</dependency>
</dependencies>
<build>
<defaultGoal>install</defaultGoal>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>${maven-assembly-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>${build-helper-maven-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
<maxmem>256M</maxmem>
<fork>${compiler.fork}</fork>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>${maven-eclipse-plugin.version}</version>
<configuration>
<downloadSources>true</downloadSources>
<downloadJavadocs>false</downloadJavadocs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-idea-plugin</artifactId>
<version>${maven-idea-plugin.version}</version>
<configuration>
<downloadSources>true</downloadSources>
<downloadJavadocs>false</downloadJavadocs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${maven-javadoc-plugin.version}</version>
<configuration>
<attach>true</attach>
<source>${jdk.version}</source>
<quiet>true</quiet>
<detectOfflineLinks>false</detectOfflineLinks>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>${maven-install-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>${maven-bundle-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>${nexus-staging-maven-plugin.version}</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>${maven-source-plugin.version}</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>${maven-release-plugin.version}</version>
<configuration>
<localCheckout>true</localCheckout>
<pushChanges>false</pushChanges>
<mavenExecutorId>forked-path</mavenExecutorId>
</configuration>
<dependencies>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-gitexe</artifactId>
<version>${maven-scm-provider-gitexe.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>${maven-deploy-plugin.version}</version>
<executions>
<execution>
<id>default-deploy</id>
<phase>deploy</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<profiles>
<profile>
<id>release-sign-artifacts</id>
<activation>
<property>
<name>performRelease</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
<configuration>
<!-- This is necessary for gpg to not try to use the pinentry programs -->
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>release</id>
<activation>
<jdk>[1.6,)</jdk>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>attach-javadoc</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<name>Central Repository OSSRH</name>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
</project>
When I do the same operation locally I get .jar.asc files.
What am I doing wrong?

It came out that the activation profile is wrong for maven-gpg-plugin
I changed it to:
<activation>
<property>
<name>gpg.passphrase</name>
</property>
</activation>
It also solves another problem that artifacts shouldn't be signed into Continuous Integration.

Related

How to deploy a multi module project to Artifactory

I want to deploy a "toolbox" to Artifactory with Maven. It's essentially a multi module project.
The goal is to deploy the toolbox, and pull it from another projects, either the separate tools or the whole toolbox. For example:
toolbox project name: `backend-tools`
tools: `mail`
and I want to pull it from another project like this:
<dependency>
<groupId>com.example</groupId>
<artifactId>backend-tools</artifactId>
<version>1.17</version>
</dependency>
Alternatively, I want, that you can pull the individual projects like this:
<dependency>
<groupId>com.example</groupId>
<artifactId>mail</artifactId>
<version>1.1</version>
</dependency>
When I pull the project the following error appears:
Could not find artifact com.example.itlab:backend-tools:pom:v0.0.1 in artifactory ({{{artifactory link}}})
my current setup:
pom.xml (mail)
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
<parent>
<groupId>com.example</groupId>
<artifactId>backend-tools</artifactId>
<version>1.2</version>
</parent>
<groupId>com.example</groupId>
<artifactId>mail</artifactId>
<version>1.1</version>
<dependencies>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<excludes>
<exclude>log4j2.xml</exclude>
<exclude>*.yml</exclude>
<exclude>*.mailprops.json</exclude>
<exclude>*_instance.properties</exclude>
</excludes>
</resource>
</resources>
<finalName>${project.artifactId}-${project.version}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<excludes>
<exclude>com.example.mail.Main</exclude>
</excludes>
</artifactSet>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>false</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<trimStackTrace>false</trimStackTrace>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
pom.xml (backend-tools)
<modelVersion>4.0.0</modelVersion>
<modules>
<module>mail</module>
</modules>
<organization>
<name><!-- ORGANISATION NAME --></name>
<url><!-- ORGANISATION URL --></url>
</organization>
<developers>
<developer>
<name><!-- DEV NAME--></name>
<roles>
<role>Developer</role>
</roles>
<email><!-- DEV EMAIL --></email>
</developer>
</developers>
<groupId>com.example.itlab</groupId>
<artifactId>backend-tools</artifactId>
<version>1.2</version>
<name>backend-tools</name>
<description>All Tools for the Backend</description>
<packaging>pom</packaging>
<properties>
<mail.version>1.4.7</mail.version>
</properties>
<distributionManagement>
<repository>
<id>release</id>
<name>Artifactory-Primary-snapshots</name>
<url><!-- <ARTIFACTORY LINK> --></url>
</repository>
<snapshotRepository>
<id>snapshot</id>
<uniqueVersion>true</uniqueVersion>
<url><!-- <ARTIFACTORY LINK> --></url>
</snapshotRepository>
</distributionManagement>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>${mail.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.4.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.0.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<configuration>
<trimStackTrace>false</trimStackTrace>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<configuration>
<source>17</source>
<target>17</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.2</version>
<configuration>
<outputDirectory>../target</outputDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.4.1</version>
<configuration>
<doclint>-html,-syntax,-accessibility,-missing</doclint>
<failOnError>false</failOnError>
<quiet>true</quiet>
<reportOutputDirectory>${project.build.directory}</reportOutputDirectory>
</configuration>
<executions>
<execution>
<phase>generate-resources</phase>
<id>attach-javadocs</id>
<goals>
<goal>javadoc</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>

Integrated an maven project to an existing maven project

I have a existing db Maven Java project in eclipse. And the second is also in Maven project with a global pom and subdirectory pom. What is the easiest way to integrate both projects into one project ? I tried to add these subfolders with the pom file. But i got the failure modules is an invalid element. Maybe there is another way to add the second project. The first project is an embedded neo4j db and the seconde project is the jung frame work. Which has also sub pom files.
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>DB</groupId>
<artifactId>DB</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<build>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>src</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
<?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>
<parent>
<groupId>db-suche</groupId>
<artifactId>db-suche</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<groupId>com.github.tomnelson</groupId>
<artifactId>jungrapht-visualization-parent</artifactId>
<version>1.4-SNAPSHOT</version>
<packaging>pom</packaging>
<name>JunGrapht Visualization</name>
<description>Jungrapht-visualization is a port of the Java Universal Network Graph (JUNG)
visualization and sample code that uses JGrapht graph models and algorithms.</description>
<url>http://tomnelson.github.io/jungraphtvisualization/</url>
<licenses>
<license>
<name>The BSD License</name>
<url>https://github.com/tomnelson/jungrapht/blob/master/LICENSE</url>
<distribution>repo</distribution>
</license>
</licenses>
<developers>
<developer>
<id>tomnelson</id>
<name>Tom</name>
<email>tomnelson#users.noreply.github.com</email>
<organization>WrenchIO</organization>
<organizationUrl>https://wrench.io/</organizationUrl>
<roles>
<role>Owner</role>
<role>Developer</role>
</roles>
<timezone>-5</timezone>
</developer>
</developers>
<prerequisites>
<maven>3.1.1</maven>
</prerequisites>
<modules>
<module>jungrapht-visualization</module>
<module>jungrapht-layout</module>
<module>jungrapht-visualization-samples</module>
</modules>
<scm>
<connection>scm:git:git://github.com/tomnelson/jungrapht.git</connection>
<developerConnection>scm:git:git://github.com/tomnelson/jungrapht.git</developerConnection>
<url>https://github.com/tomnelson/jungrapht</url>
</scm>
<distributionManagement>
<repository>
<id>sonatype-nexus-staging</id>
<name>Nexus Release Repository</name>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
<snapshotRepository>
<id>sonatype-nexus-snapshots</id>
<name>Sonatype Nexus Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
<properties>
<cobertura.plugin.version>2.7</cobertura.plugin.version>
<compiler.plugin.version>3.8.0</compiler.plugin.version>
<doclint>none</doclint>
<fmt.plugin.version>1.8.0</fmt.plugin.version>
<google-java-format.version>1.3</google-java-format.version>
<gpg.plugin.version>1.6</gpg.plugin.version>
<jar.plugin.version>2.6</jar.plugin.version>
<java.version>11</java.version>
<javadoc.plugin.version>3.1.0</javadoc.plugin.version>
<jgrapht.version>1.5.1</jgrapht.version>
<junit.version>4.13.1</junit.version>
<jxr.plugin.version>2.5</jxr.plugin.version>
<pmd.plugin.version>3.12.0</pmd.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<release.plugin.version>2.5.3</release.plugin.version>
<source.plugin.version>3.0.1</source.plugin.version>
<surefire.plugin.version>2.19.1</surefire.plugin.version>
<version.logback>1.2.10</version.logback>
<version.slf4j>1.7.32</version.slf4j>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
</dependency>
<dependency>
<groupId>org.jgrapht</groupId>
<artifactId>jgrapht-core</artifactId>
<version>${jgrapht.version}</version>
</dependency>
<dependency>
<groupId>org.jgrapht</groupId>
<artifactId>jgrapht-guava</artifactId>
<version>${jgrapht.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<defaultGoal>clean verify</defaultGoal>
<pluginManagement>
<plugins>
<plugin>
<groupId>com.github.ekryd.sortpom</groupId>
<artifactId>sortpom-maven-plugin</artifactId>
<version>2.4.0</version>
<executions>
<execution>
<id>sort-pom</id>
<goals>
<goal>sort</goal>
</goals>
<phase>process-sources</phase>
<configuration>
<predefinedSortOrder>recommended_2008_06</predefinedSortOrder>
<createBackupFile>false</createBackupFile>
<lineSeparator>\n</lineSeparator>
<expandEmptyElements>false</expandEmptyElements>
<nrOfIndentSpace>4</nrOfIndentSpace>
<sortDependencies>scope,groupId,artifactId</sortDependencies>
<sortPlugins>groupId,artifactId</sortPlugins>
<sortProperties>true</sortProperties>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${compiler.plugin.version}</version>
<configuration>
<release>11</release>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
</plugin>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>${release.plugin.version}</version>
<configuration>
<mavenExecutorId>forked-path</mavenExecutorId>
<useReleaseProfile>false</useReleaseProfile>
<arguments>${arguments} -Psonatype-oss-release</arguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.8.2</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>com.coveo</groupId>
<artifactId>fmt-maven-plugin</artifactId>
<version>${fmt.plugin.version}</version>
<dependencies>
<dependency>
<groupId>com.google.googlejavaformat</groupId>
<artifactId>google-java-format</artifactId>
<version>${google-java-format.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<goals>
<goal>format</goal>
</goals>
<phase>verify</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.github.ekryd.sortpom</groupId>
<artifactId>sortpom-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<!-- generates aggregated javadoc for root project -->
<artifactId>maven-javadoc-plugin</artifactId>
<version>${javadoc.plugin.version}</version>
</plugin>
<plugin>
<artifactId>maven-jxr-plugin</artifactId>
<version>${jxr.plugin.version}</version>
</plugin>
<plugin>
<artifactId>maven-pmd-plugin</artifactId>
<version>${pmd.plugin.version}</version>
<configuration>
<targetJdk>${java.version}</targetJdk>
<linkXref>true</linkXref>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>${surefire.plugin.version}</version>
</plugin>
</plugins>
</reporting>
<profiles>
<profile>
<id>sonatype-oss-release</id>
<build>
<plugins>
<plugin>
<artifactId>maven-gpg-plugin</artifactId>
<version>${gpg.plugin.version}</version>
<executions>
<execution>
<id>sign-artifacts</id>
<goals>
<goal>sign</goal>
</goals>
<phase>verify</phase>
<configuration>
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${javadoc.plugin.version}</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<additionalparam>-Xdoclint:none</additionalparam>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>${source.plugin.version}</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

Maven Surefire Test Rerun Parameter Does Not Re-Run Failing Tests

Maven surefire does not rerun failing tests. I tried to change the surefire version to 3.0.0-M4, 3.0.0-M5. Use commandline option -Dsurefire.rerunFailingTestsCount=3, added <surefire.rerunFailingTestsCount>2</surefire.rerunFailingTestsCount> to the pom file, and added 2 to the configurations of surefire plugin; ran mvn install multiple times. However, nothing seems to work and Surefire runs failing tests just once. The pom file of the project I am working with is:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
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.authy</groupId>
<artifactId>authy-java</artifactId>
<version>1.5.1</version>
<packaging>jar</packaging>
<name>Authy Java</name>
<description>Java library to access the Authy API.</description>
<url>https://github.com/authy/authy-java</url>
<licenses>
<license>
<name>The MIT License (MIT)</name>
<url>https://github.com/authy/authy-java/blob/master/LICENSE.txt</url>
</license>
</licenses>
<developers>
<developer>
<name>Sergio Aristizabal</name>
<email>saristizabal#twilio.com</email>
<organization>Twilio</organization>
<organizationUrl>http://www.twilio.com</organizationUrl>
</developer>
</developers>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<scm>
<connection>scm:git:git#github.com:authy/authy-java.git</connection>
<developerConnection>scm:git:git#github.com:authy/authy-java.git</developerConnection>
<url>git#github.com:authy/authy-java.git</url>
</scm>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.hamcrest/hamcrest-core -->
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>2.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>9.4.44.v20210927</version>
</dependency>
<dependency>
<groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>caffeine</artifactId>
<version>2.5.5</version>
</dependency>
<dependency>
<groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>caffeine</artifactId>
<version>2.5.5</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.10.19</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20150729</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock</artifactId>
<version>2.11.0</version>
<scope>test</scope>
</dependency>
</dependencies>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<name>Authy Maven Snapshot Repository</name>
<url>
https://oss.sonatype.org/content/repositories/snapshots/
</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<name>Authy Maven Repository</name>
<url>
https://oss.sonatype.org/service/local/staging/deploy/maven2/
</url>
</repository>
</distributionManagement>
<profiles>
<profile>
<id>release</id>
<activation>
<property>
<name>performRelease</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<rerunFailingTestsCount>2</rerunFailingTestsCount>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<executions>
<execution>
<id>default-testCompile</id>
<phase>test-compile</phase>
<goals>
<goal>testCompile</goal>
</goals>
<configuration combine.self="override">
<skip>true</skip>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>edu.illinois.cs</groupId>
<artifactId>testrunner-maven-plugin</artifactId>
<version>1.2</version>
<dependencies>
<dependency>
<groupId>edu.illinois.cs</groupId>
<artifactId>idflakies</artifactId>
<version>1.2.0-SNAPSHOT</version>
</dependency>
</dependencies>
<configuration>
<className>edu.illinois.cs.dt.tools.detection.DetectorPlugin</className>
</configuration>
</plugin>
<plugin>
<groupId>edu.illinois</groupId>
<artifactId>nondex-maven-plugin</artifactId>
<version>1.1.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<configuration>
<autoVersionSubmodules>true</autoVersionSubmodules>
<useReleaseProfile>false</useReleaseProfile>
<!-- references the profile defined just below -->
<releaseProfiles>release</releaseProfiles>
<goals>deploy</goals>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.3</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.7</version>
<configuration>
<formats>
<format>html</format>
<format>xml</format>
</formats>
<check />
</configuration>
</plugin>
</plugins>
</build>
</project>
I am a little bit lost what might be causing the failing tests to be executed multiple times as I tried a lot of different suggestions on stackoverflow.
Thanks in advance!
There are some missing configurations under maven-surfire-plugin. Please, have a look at the working configuration:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<includes>
<include>**/TestRunner.java</include>
</includes>
<argLine>
-javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${org.aspectj.version}/aspectjweaver-${org.aspectj.version}.jar"
</argLine>
<rerunFailingTestsCount>${rerunCount}</rerunFailingTestsCount>
</configuration>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${org.aspectj.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>${maven-surefire-plugin.version}</version>
</dependency>
</dependencies>
</plugin>

I have an error in pom.xml file

I got an error that is shown in picture
you can see error in the picture that i given this error comes at line where i write a packaging tag when i remove this tag then error come at this point (http://maven.apache.org/maven-v4_0_0.xsd)
here is my pom.xml file
<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.github.haifengl</groupId>
<packaging>jar</packaging>
<artifactId>smile-plot</artifactId>
<version>1.1.0</version>
<name>Smile Plot</name>
<description>Statistical Machine Intelligence and Learning Engine -- Plot</description>
<url>http://github.com/haifengl/smile</url>
<licenses>
<license>
<name>Apache License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<developers>
<developer>
<name>Haifeng Li</name>
<email>haifeng.hli#gmail.com</email>
<url>http://haifengl.wordpress.com</url>
<roles>
<role>architect</role>
<role>developer</role>
</roles>
<timezone>America/New_York</timezone>
<properties>
<twitter>#haifengl</twitter>
</properties>
</developer>
</developers>
<scm>
<connection>scm:git:git#github.com:haifengl/smile.git</connection>
<developerConnection>scm:git:git#github.com:haifengl/smile.git</developerConnection>
<url>git#github.com:haifengl/smile.git</url>
</scm>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.github.haifengl</groupId>
<artifactId>smile-math</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>com.github.haifengl</groupId>
<artifactId>smile-core</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>org.swinglabs</groupId>
<artifactId>swingx</artifactId>
<version>1.6.1</version>
</dependency>
</dependencies>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
<profiles>
<profile>
<id>doclint-java8-disable</id>
<activation>
<jdk>[1.8,)</jdk>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.3</version>
<configuration>
<additionalparam>-Xdoclint:none</additionalparam>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.3</version>
<configuration>
<additionalparam>-Xdoclint:none</additionalparam>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.3</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
</plugins>
</build>

java.lang.NoClassDefFoundError on running project with Java, but works when running with mvn exec:exec

I'm compiling and running some source code I got from a project called Structr (https://github.com/structr/structr). I'm able to run the program correctly with a maven mvn command but not using the JVM java command.
The compilation step goes well with maven clean install -DskipTests
On running the front-end (in the structr-ui directory), it goes well if using maven exec:exec but fails on java -cp target/lib/*;target/structr-ui-0.8.2.jar org.structr.Ui. I have some stack trace indicating java.lang.NoClassDefFoundError on org.structr.core.entity.AbstractNode and org.structr.core.EntityContext. What I find strange about this is that the maven pom.xml file in the exec entry we have
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<configuration>
<executable>java</executable>
<arguments>
<argument>-server</argument>
<argument>-Dfile.encoding=utf-8</argument>
<argument>-XX:+UseNUMA</argument>
<argument>-Xms1g</argument>
<argument>-Xmx1g</argument>
<argument>-classpath</argument>
<argument>target/lib/*;target/structr-ui-0.8.2.jar</argument>
<argument>org.structr.Ui</argument>
</arguments>
</configuration>
</plugin>
The entire pom.xml reads
<?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>
<parent>
<groupId>org.structr</groupId>
<artifactId>structr</artifactId>
<version>0.8.2</version>
</parent>
<groupId>org.structr</groupId>
<artifactId>structr-ui</artifactId>
<packaging>jar</packaging>
<version>0.8.2</version>
<name>structr-ui</name>
<description>Structr is an open source framework based on the popular Neo4j graph database.</description>
<developers>
<developer>
<name>Axel Morgner</name>
<email>am#structr.org</email>
</developer>
<developer>
<name>Christian Morgner</name>
<email>cm#structr.org</email>
</developer>
</developers>
<url>http://structr.org</url>
<properties>
<netbeans.hint.license>structr-agpl30</netbeans.hint.license>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>neo4j-releases</id>
<url>http://m2.neo4j.org/content/repositories/releases</url>
</repository>
<repository>
<id>neo4j-snapshots</id>
<url>http://m2.neo4j.org/content/repositories/snapshots</url>
</repository>
<repository>
<id>google-diff-patch-match</id>
<name>google-diff-patch-match</name>
<url>http://google-diff-match-patch.googlecode.com/svn/trunk/maven/</url>
</repository>
<repository>
<id>jodd</id>
<url>http://repo1.maven.org/maven2/org/jodd/</url>
</repository>
<!-- <repository>
<id>alfresco-releases</id>
<url>https://maven.alfresco.com/nexus/content/repositories/releases</url>
</repository>
<repository>
<id>alfresco-snapshots</id>
<url>https://maven.alfresco.com/nexus/content/repositories/snapshots</url>
</repository>-->
<repository>
<id>snapshots.maven.structr.org</id>
<url>http://maven.structr.org/artifactory/snapshot</url>
</repository>
<repository>
<id>releases.maven.structr.org</id>
<url>http://maven.structr.org/artifactory/release</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>structr-server</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<type>jar</type>
<scope>test</scope>
<optional>false</optional>
</dependency>
<!-- <dependency>
<artifactId>urlrewritefilter</artifactId>
<groupId>org.tuckey</groupId>
<type>jar</type>
<version>4.0.4</version>
</dependency>-->
<dependency>
<groupId>diff_match_patch</groupId>
<artifactId>diff_match_patch</artifactId>
<version>current</version>
</dependency>
<dependency>
<groupId>org.pegdown</groupId>
<artifactId>pegdown</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>net.java</groupId>
<artifactId>textile-j</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.0-m09</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-client</artifactId>
<version>1.9-ea04</version>
</dependency>
<!-- <dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-rest-graphdb</artifactId>
<version>1.9.5</version>
</dependency>-->
<dependency>
<groupId>com.flagstone</groupId>
<artifactId>transform</artifactId>
<version>3.0.2</version>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.7.1</version>
</dependency>
<dependency>
<groupId>org.jodd</groupId>
<artifactId>jodd-lagarto</artifactId>
<version>3.4.5</version>
</dependency>
<!-- <dependency>
<groupId>org.jodd</groupId>
<artifactId>jodd-http</artifactId>
<version>3.4.5</version>
</dependency>-->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.4.1</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.8</version>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
<version>3.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.5</version>
</dependency>
<dependency>
<groupId>org.apache.oltu.oauth2</groupId>
<artifactId>org.apache.oltu.oauth2.client</artifactId>
<version>0.31</version>
</dependency>
<dependency>
<groupId>org.twitter4j</groupId>
<artifactId>twitter4j-core</artifactId>
<version>3.0.5</version>
</dependency>
<dependency>
<groupId>org.apache.ftpserver</groupId>
<artifactId>ftpserver-core</artifactId>
<version>1.0.6</version>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
<testResources>
<testResource>
<directory>src/main/resources</directory>
</testResource>
</testResources>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<configuration>
<executable>java</executable>
<arguments>
<argument>-server</argument>
<argument>-Dfile.encoding=utf-8</argument>
<argument>-XX:+UseNUMA</argument>
<argument>-Xms1g</argument>
<argument>-Xmx1g</argument>
<argument>-classpath</argument>
<argument>target/lib/*;target/structr-ui-0.8.2.jar</argument>
<argument>org.structr.Ui</argument>
</arguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<debug>true</debug>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib</classpathPrefix>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<configuration>
<descriptors>
<descriptor>src/main/resources/assemblies/dist.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>attached</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.vafer</groupId>
<artifactId>jdeb</artifactId>
<version>1.0.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jdeb</goal>
</goals>
<configuration>
<timestamped>true</timestamped>
<controlDir>${basedir}/src/main/deb/control</controlDir>
<dataSet>
<data>
<src>${project.build.directory}/${project.build.finalName}.jar</src>
<type>file</type>
<dst>structr-ui.jar</dst>
<mapper>
<type>perm</type>
<prefix>/usr/lib/${project.artifactId}/</prefix>
</mapper>
</data>
<data>
<src>${project.build.directory}/lib</src>
<type>directory</type>
<mapper>
<type>perm</type>
<prefix>/usr/lib/${project.artifactId}/lib</prefix>
<filemode>755</filemode>
</mapper>
</data>
<data>
<src>${basedir}/seed.zip</src>
<type>file</type>
<mapper>
<type>perm</type>
<prefix>/usr/lib/${project.artifactId}/</prefix>
<filemode>755</filemode>
</mapper>
</data>
<data>
<src>${basedir}/src/main/deb/bin</src>
<type>directory</type>
<mapper>
<type>perm</type>
<prefix>/usr/lib/${project.artifactId}/bin</prefix>
<filemode>755</filemode>
</mapper>
</data>
<data>
<src>${basedir}/src/main/deb/init.d</src>
<type>directory</type>
<mapper>
<type>perm</type>
<prefix>/etc/init.d</prefix>
<filemode>755</filemode>
</mapper>
</data>
</dataSet>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<finalName>${project.artifactId}-${project.version}</finalName>
<!-- Added to make m2e happy, thanks to http://stackoverflow.com/questions/8706017/maven-dependency-plugin-goals-copy-dependencies-unpack-is-not-supported-b -->
<pluginManagement>
<plugins>
<!-- Ignore/Execute plugin execution -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<!-- copy-dependency plugin -->
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<versionRange>[1.0.0,)</versionRange>
<goals>
<goal>copy-dependencies</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<profiles>
<profile>
<id>release-sign-artifacts</id>
<activation>
<property>
<name>performRelease</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<licenses>
<license>
<name>GNU General Public License, Version 3</name>
<url>http://www.gnu.org/licenses/agpl-3.0-standalone.html</url>
<comments>
Copyright (C) 2010-2013 Axel Morgner, structr <structr#structr.org>
This file is part of structr <http://structr.org>.
structr is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
structr is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with structr. If not, see <http://www.gnu.org/licenses/>.
</comments>
</license>
</licenses>
<scm>
<url>https://github.com/structr/structr</url>
<connection>scm:git:git#github.com:structr/structr.git</connection>
</scm>
<distributionManagement>
<!-- <repository>
<id>releases.maven.structr.org</id>
<name>maven.structr.org-releases</name>
<url>http://maven.structr.org/artifactory/release</url>
</repository>
<snapshotRepository>
<id>snapshots.maven.structr.org</id>
<name>maven.structr.org-snapshots</name>
<url>http://maven.structr.org/artifactory/snapshot</url>
</snapshotRepository>-->
<repository>
<id>sonatype-nexus-staging</id>
<name>Maven Central Staging</name>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
</repository>
<snapshotRepository>
<id>sonatype-nexus-snapshots</id>
<name>Maven Central Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
</project>
The mvn exec:exec statement looks equivalent to the java JVM statement. This question may be basically; What is maven doing differently than java, that in the maven case making the program run correctly?
Edit - additional maven and java debugging information
On mvn -X exec:exec, The output is given here http://roberthoff.com/files/mvn_exec_trace.txt
And on java -server -Dfile.encoding=utf-8 -XX:+UseNUMA -Xms1g -Xmx1g -classpath target/lib/*
;target/structr-ui-0.8.2.jar org.structr.Ui we have http://roberthoff.com/files/java_trace.txt
You have a valid question here, because according to the Maven documentation on the exec:exec goal you would need to have the <\classpath> stanza in your configuration in order to include the entire project module classpath.
However, it appears as though Maven is running the program with the fully (and properly) configured classpath for some reason.
In order to get to the bottom of the problem, I'd run Maven with the -X command line argument and carefully scan through the debug output until I found the exact command it runs. Then I'd try running it from the same directory, ensuring I am using the same Java installation and see if it works.
Notice the maven-dependency-plugin in the pom. It copies all dependencies during the package phase to target/lib folder and then they are on classpath. Following should work:
maven clean package -DskipTests
java -cp target/lib/*;target/structr-ui-0.8.2.jar org.structr.Ui

Categories

Resources