Maven NumberFormatException when packaging - java

I'm getting a really weird error on my Windows PC when running mvn package (or mvn install/deploy) on a project. This error only happens on this machine, everything works fine on my laptop and other computers. I used to be able to package/install the project without problems, but now even older commits and branches throw this exception.
java.lang.NumberFormatException: For input string: "34m[[["
at java.lang.NumberFormatException.forInputString(NumberFormatException java:65)
at java.lang.Integer.parseInt(Integer.java:580)
at java.lang.Integer.<init>(Integer.java:867)
at org.fusesource.jansi.AnsiOutputStream.write(AnsiOutputStream.java:12)
at java.io.FilterOutputStream.write(FilterOutputStream.java:125)
at java.io.PrintStream.write(PrintStream.java:480)
at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221)
at sun.nio.cs.StreamEncoder.implWrite(StreamEncoder.java:282)
at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:125)
at java.io.OutputStreamWriter.write(OutputStreamWriter.java:207)
at java.io.BufferedWriter.flushBuffer(BufferedWriter.java:129)
at java.io.PrintStream.write(PrintStream.java:526)
at java.io.PrintStream.print(PrintStream.java:669)
at java.io.PrintStream.println(PrintStream.java:806)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:423)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Console error screenshot
I'm using Maven 3.5.2 and Java 1.8.0_91. I already tried reinstalling Maven.
I found this SO post that apparently has a similar problem, but there are no solutions posted.
Anybody have an idea what could cause this?
If I run it with mvn clean install -B it produces the following error for the whole console log:
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
(screenshot)
Here's my POM 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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>****</groupId>
<artifactId>sniffer</artifactId>
<version>0.6-SNAPSHOT</version>
<name>sniffer</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<packaging>pom</packaging>
<modules>
<module>sniffergui</module>
<module>sniffercollector</module>
<module>snifferapp</module>
<module>snifferstats</module>
</modules>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.0.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.0.1</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.0.1</version>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>4.12.1</version>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
<version>1.0.1</version>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-runner</artifactId>
<version>1.0.1</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>PRISE_gruppe_5_releases</id>
<name>sniffer_releases</name>
<url>http://prise-runner.aot.tu-berlin.de:8081/repository/PRISE_gruppe_5_releases/</url>
</repository>
<repository>
<id>PRISE_gruppe_5_snapshots</id>
<name>sniffer_snapshots</name>
<url>http://prise-runner.aot.tu-berlin.de:8081/repository/PRISE_gruppe_5_snapshots/</url>
</repository>
</repositories>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
<configuration>
<effort>Max</effort>
<threshold>Low</threshold>
<xmlOutput>true</xmlOutput>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.8</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.0.0</version>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.0</version>
<executions>
<execution>
<id>pre-unit-test</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<destFile>${project.build.directory}/coverage-reports/jacoco-ut.exec</destFile>
<propertyName>surefireArgLine</propertyName>
</configuration>
</execution>
<execution>
<id>post-unit-test</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<dataFile>${project.build.directory}/coverage-reports/jacoco.exec</dataFile>
<outputDirectory>${project.reporting.outputDirectory}/jacoco</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<argLine>${surefireArgLine}</argLine>
<skipTests>${skip.unit.tests}</skipTests>
<excludes>
<exclude>**/IT*.java</exclude>
</excludes>
</configuration>
<dependencies>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-surefire-provider</artifactId>
<version>1.0.1</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.0.1</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.15</version>
<executions>
<execution>
<id>integration-tests</id>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<argLine>${failsafeArgLine}</argLine>
<skipTests>${skip.integration.tests}</skipTests>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
<distributionManagement>
<repository>
<id>***_releases</id>
<name>sniffer_releases</name>
<url>*****</url>
</repository>
<snapshotRepository>
<id>***_snapshots</id>
<name>sniffer_snapshots</name>
<url>*****</url>
</snapshotRepository>
</distributionManagement>
</project>

As #Oleg said in the comments, set MAVEN_OPTS=-Xss10M seems to fix the issue. It sometimes has to be called again if the error returns. All other options did not solve the problem for me.

Are you running mvn with -T option (multi-thread)?
What you describe sounds like this issue:
https://issues.apache.org/jira/browse/MNG-6382
Try to upgrade to maven 3.5.3 see if it solves your problem. The fix for the bug above is in 3.5.3

I found another way apart from Olegs solution (which also works for me) to avoid this bug:
Just pipe the output into a file and the build succeeds:
mvn clean install > build.log

Related

Maven cannot resolve AWS-CDK dependencies (Java)

I'm attempting to build a Maven multi-module project which uses the AWS CDK software.amazon.awscdk package.
However, I consistently get a DependencyResolutionException error:
[ERROR] Failed to execute goal on project github-api-infrastructure: Could not resolve dependencies for project pixee:github-api-infrastructure:jar:dev: Failed to collect dependencies at software.amazon.awscdk:aws-cdk-lib:jar:2.17.0 -> software.constructs:constructs:jar:[10.0.0,11.0.0): No versions available for software.constructs:constructs:jar:[10.0.0,11.0.0) within specified range -> [Help 1]
The error says it cannot find a software.constructs package with the right version, but it should exist on the Maven repositories.
I've tried updating my Maven version, clearing the Maven cache and rebuilding, but I get the same error.
This is the only module that fails to build, so I don't expect it to be a problem listed in DependencyResolutionException documentation such as the connection to the remote repository being misconfigured or a network problem.
The build works on my teammates computers, but not on mine. I'm not sure what could possibly be the issue, since we're on the same-ish Java (I'm on 17, they have 18) version and same Maven version.
Not familiar with the Java ecosystem, please let me know if additional clarification is needed.
Multi-module pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>x</groupId>
<artifactId>github-api</artifactId>
<packaging>pom</packaging>
<version>dev</version>
<modules>
<module>testutils</module>
<module>core</module>
<module>functions</module>
<module>infra</module>
</modules>
<distributionManagement>
<repository>
<id>central</id>
<name>x-libs-release</name>
<url>https://x.jfrog.io/artifactory/mailman</url>
</repository>
</distributionManagement>
<repositories>
<repository>
<id>central</id>
<name>x-libs-release</name>
<url>https://x.jfrog.io/artifactory/mailman</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>snapshots</id>
<name>x-libs-snapshot</name>
<url>https://x.jfrog.io/artifactory/mailman</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<properties>
<fmt.goal>format</fmt.goal>
<versions.fmt-maven-plugin>2.18</versions.fmt-maven-plugin>
<versions.maven-shade-plugin>3.2.4</versions.maven-shade-plugin>
<versions.maven-compiler-plugin>3.8.1</versions.maven-compiler-plugin>
<versions.maven-surefire-plugin>3.0.0-M4</versions.maven-surefire-plugin>
<versions.maven-failsafe-plugin>2.22.0</versions.maven-failsafe-plugin>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<versions.jackson>2.13.2</versions.jackson>
<versions.log4j>2.17.1</versions.log4j>
<versions.awssdk>1.12.99</versions.awssdk>
<versions.junit-jupiter>5.7.0</versions.junit-jupiter>
<versions.hamcrest>1.3</versions.hamcrest>
<versions.mockito>4.3.1</versions.mockito>
<versions.hsqldb>2.6.1</versions.hsqldb>
<versions.mariadb>2.6.0</versions.mariadb>
</properties>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${versions.maven-compiler-plugin}</version>
<configuration>
<forceJavacCompilerUse>true</forceJavacCompilerUse>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.7</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>generate-code-coverage-report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${versions.maven-surefire-plugin}</version>
<configuration>
<trimStackTrace>false</trimStackTrace>
</configuration>
</plugin>
<plugin>
<groupId>com.spotify.fmt</groupId>
<artifactId>fmt-maven-plugin</artifactId>
<version>${versions.fmt-maven-plugin}</version>
<executions>
<execution>
<id>format-java</id>
<phase>validate</phase>
<goals>
<goal>${fmt.goal}</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${versions.maven-failsafe-plugin}</version>
<configuration>
<includes>
<include>**/IT</include>
</includes>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<profiles>
<profile>
<id>ci</id>
<activation>
<property>
<name>env.CI</name>
</property>
</activation>
<properties>
<fmt.goal>check</fmt.goal>
</properties>
</profile>
</profiles>
</project>
Infra module pom.xml (only module that fails):
<?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>
<parent>
<groupId>x</groupId>
<artifactId>github-api</artifactId>
<version>dev</version>
</parent>
<artifactId>github-api-infrastructure</artifactId>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<versions.awscdk>2.17.0</versions.awscdk>
<versions.constructs>10.0.91</versions.constructs>
<versions.mybatis>3.3.10</versions.mybatis>
</properties>
<dependencies>
<dependency>
<groupId>x</groupId>
<artifactId>github-api-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>x</groupId>
<artifactId>github-api-testutils</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>${versions.log4j}</version>
</dependency>
<dependency>
<groupId>software.amazon.awscdk</groupId>
<artifactId>aws-cdk-lib</artifactId>
<version>${versions.awscdk}</version>
<exclusions>
<exclusion>
<artifactId>jackson-core</artifactId>
<groupId>com.fasterxml.jackson.core</groupId>
</exclusion>
<exclusion>
<artifactId>jackson-databind</artifactId>
<groupId>com.fasterxml.jackson.core</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>software.constructs</groupId>
<artifactId>constructs</artifactId>
<version>${versions.constructs}</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-migrations</artifactId>
<version>${versions.mybatis}</version>
</dependency>
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<version>${versions.mariadb}</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${versions.junit-jupiter}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>${versions.junit-jupiter}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>${versions.hamcrest}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>${versions.mockito}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>${versions.hsqldb}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>resource-dependencies</id>
<phase>compile</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>x</groupId>
<artifactId>github-api-functions</artifactId>
<version>${parent.version}</version>
<type>jar</type>
<overWrite>true</overWrite>
<outputDirectory>${project.build.directory}</outputDirectory>
<destFileName>github-api-functions.jar</destFileName>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<!-- Create a runnable JAR -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>${versions.maven-shade-plugin}</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<finalName>${project.artifactId}</finalName>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>**/Log4j2Plugins.dat</exclude>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>com.spotify.fmt</groupId>
<artifactId>fmt-maven-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Maven version:
Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63)
Maven home: /opt/maven
Java version: 17.0.4, vendor: Private Build, runtime: /usr/lib/jvm/java-17-openjdk-amd64
Default locale: en, platform encoding: UTF-8
OS name: "linux", version: "5.4.72-microsoft-standard-wsl2", arch: "amd64", family: "unix"
Java Version:
openjdk 17.0.4 2022-07-19
OpenJDK Runtime Environment (build 17.0.4+8-Ubuntu-120.04)
OpenJDK 64-Bit Server VM (build 17.0.4+8-Ubuntu-120.04, mixed mode, sharing)
I'm running Ubuntu 20.04.5 LTS on WSL 2.
Update:
I tried rebuilding it yesterday and the build was successful with no errors. I didn't change anything. Perhaps the package repositories were updated?
I tried rebuilding it today and I get the same error as before. I wonder if it's an error due to how Maven is configured locally on WSL. But why would it affect just this package?
I'm thinking now the dependency resolution fails because of something on JFrogs side.
Finally the problem was with my permissions on JFrog. I was upgraded to an admin and I didn't encounter the same error during build again.

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>

Netbeans runtime configuration in jar

I have a maven project and jni4net is one of the dependency and it's running fine in Netbeans. But when i package it into a jar i get the error java.lang.UnsatisfiedLinkError: no jni4net.n-0.8.8.0 in java.library.path. I solved this problem in Netbenas by setting Working directory and VM Options in Project Properties -> Run. Now is there a way to include these configurations while packaging it as jar, or any other solution.
Thanks in advance...
Here is my pom
<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.base</groupId>
<artifactId>base</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>BASE</name>
<repositories>
<repository>
<id>repo</id>
<url>file://${project.basedir}/./temp-repo</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>jni4net</groupId>
<artifactId>jni4net.j</artifactId>
<version>0.8.8.0</version>
</dependency>
<dependency>
<groupId>customId</groupId>
<artifactId>customId</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-chrome-driver</artifactId>
<version>3.0.0-beta2</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-firefox-driver</artifactId>
<version>3.0.0-beta2</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.3.5</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>copy</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>3.0.2</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>com.mysite.myproject.Main</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
<resources>
<resource>
<directory>lib</directory>
<!--<filtering>true</filtering>-->
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

How to pack switchyard application with maven

How can I pack switchyard application with has dependencies to my another project with Maven? Currently I'm trying to make things work as explained here
official dock.
But with no result, on startup of application in log file I see
Caused by: java.lang.NoClassDefFoundError: com/aspiderngi/common/switchyard/InventoryRequest
Caused by: java.lang.ClassNotFoundException: com.aspiderngi.common.switchyard.InventoryRequest from...
Is it possible to achieve anyways?
pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example.switchyard</groupId>
<version>0.0.1-SNAPSHOT</version>
<name>com.example.switchyard:sy-example</name>
<artifactId>sy-example</artifactId>
<properties>
<switchyard.version>2.0.0.Final</switchyard.version>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
<packaging>war</packaging>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.switchyard</groupId>
<artifactId>switchyard-bom</artifactId>
<version>${switchyard.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>com.aspiderngi</groupId>
<artifactId>artifacts-common</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.switchyard.components</groupId>
<artifactId>switchyard-component-camel</artifactId>
</dependency>
<dependency>
<groupId>org.switchyard.components</groupId>
<artifactId>switchyard-component-camel-jms</artifactId>
</dependency>
<dependency>
<groupId>org.switchyard.components</groupId>
<artifactId>switchyard-component-resteasy</artifactId>
</dependency>
<dependency>
<groupId>org.switchyard</groupId>
<artifactId>switchyard-api</artifactId>
</dependency>
<dependency>
<groupId>org.switchyard</groupId>
<artifactId>switchyard-transform</artifactId>
</dependency>
<dependency>
<groupId>org.switchyard</groupId>
<artifactId>switchyard-validate</artifactId>
</dependency>
<dependency>
<groupId>org.switchyard</groupId>
<artifactId>switchyard-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.switchyard.components</groupId>
<artifactId>switchyard-component-test-mixin-cdi</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.switchyard.components</groupId>
<artifactId>switchyard-component-bean</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.switchyard</groupId>
<artifactId>switchyard-plugin</artifactId>
<version>${switchyard.version}</version>
<executions>
<execution>
<goals>
<goal>configure</goal>
</goals>
</execution>
</executions>
<configuration>
<scannerClassNames>
<param>org.switchyard.transform.config.model.TransformSwitchYardScanner</param>
</scannerClassNames>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<packagingExcludes>
WEB-INF/lib/*.jar,
WEB-INF/classes/META-INF/switchyard.xml
</packagingExcludes>
<webResources>
<resource>
<directory>target/classes/META-INF</directory>
<targetPath>WEB-INF</targetPath>
<includes>
<include>switchyard.xml</include>
</includes>
</resource>
</webResources>
</configuration>
</plugin>
</plugins>
</build>
</project>
You can use Maven Shade plugin:
https://maven.apache.org/plugins/maven-shade-plugin/
example:
<project>
...
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>jackofall</shadedClassifierName> <!-- Any name that makes sense -->
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
...
</project>
Please try this out. The dependent project must have its own pom.xml(child)
Include this child pom to the parent pom. And include the below code in the parent pom.xml
This would directly deploy the application in the server
From project root in cmd execute the below commands:
1. mvn clean
2. mvn dependency:resolve
3. mvn install
if you are using Eclipse, use maven update. then Run As maven install
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<debug>true</debug>
</configuration>
</plugin>
<plugin>
<groupId>org.jboss.as.plugins</groupId>
<artifactId>jboss-as-maven-plugin</artifactId>
<configuration>
<skip>false</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.switchyard</groupId>
<artifactId>switchyard-plugin</artifactId>
<version>${switchyard.version}</version>
<executions>
<execution>
<goals>
<goal>configure</goal>
</goals>
</execution>
</executions>
<configuration>
<scannerClassNames>
<param>org.switchyard.transform.config.model.TransformSwitchYardScanner</param>
</scannerClassNames>
</configuration>
</plugin>
<plugin>
<groupId>org.jboss.as.plugins</groupId>
<artifactId>jboss-as-maven-plugin</artifactId>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
if you are using Bean then include
<scannerClassNames>
<param>org.switchyard.transform.config.model.BeanSwitchYardScanner</param>
</scannerClassNames>

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