killAfter deprecated warning when running exec:java - java

I have noticed that I get this warning every time I run my exec:java command in MAVEN.
[WARNING] Warning: killAfter is now deprecated. Do you need it ? Please comment on MEXEC-6.
How can I get rid of it? I have been searching for it, but no clue.
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>foodfinder</groupId>
<artifactId>food-client</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Food Finder client</name>
<description>The client application for the Food Finder</description>
<dependencies>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20140107</version>
</dependency>
<dependency>
<groupId>org.apache.uima</groupId>
<artifactId>uimaj-tools</artifactId>
<version>2.6.0</version>
</dependency>
<dependency>
<groupId>commons-validator</groupId>
<artifactId>commons-validator</artifactId>
<version>1.4.0</version>
</dependency>
<dependency>
<groupId>com.razican.utils</groupId>
<artifactId>java-utils</artifactId>
<version>0.1.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.3.2</version>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<issueManagement>
<system>GitHub</system>
<url>https://github.com/Razican/FoodClient/issues</url>
</issueManagement>
<ciManagement>
<system>Travis-CI</system>
<url>https://travis-ci.org/Razican/FoodClient</url>
</ciManagement>
<repositories>
<repository>
<id>Java-Utils</id>
<url>https://raw.github.com/Razican/Java-Utils/mvn-repo/</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<archive>
<manifest>
<mainClass>foodfinder.client.Launcher</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.3.2</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>foodfinder.client.Launcher</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</project>

To get rid of this warning you need to amend your pom.xml
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.3.2</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<!--
to get rid of the warning: [WARNING] Warning: killAfter is now deprecated. Do you need it ? Please comment on MEXEC-6.
see: method execute() in https://github.com/ispringer/exec-maven-plugin/blob/master/src/main/java/org/codehaus/mojo/exec/ExecJavaMojo.java
-->
<killAfter>-1</killAfter>
<mainClass>foodfinder.client.Launcher</mainClass>
</configuration>
</plugin>
edit This answer is not valid anymore for newer versions (> 1.3.2) of the exec-maven-plugin.
For the down-voters please have a look at the timeline.
Jul 2014 - release of plugin version 1.3.2
Nov 2014 - posting this answer
Mar 2015 - release of plugin version 1.4.0

Update to version 1.4.0 of the exec-maven-plugin. The warning no longer appears.

choose one:
1) change exec-maven-plugin configuration in your pom by adding:
<killAfter>-1</killAfter>
2) or add command-line parameter:
-Dexec.killAfter=-1

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.

Cannot start Heroku project on windows. Main class not found, and if found it cannot find other classes

I am trying to deploy my first discord bot to heroku, but it cannot find the main File.
My pom.xml looks like this:`
<?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>org.example</groupId>
<artifactId>kostisBot</artifactId>
<version>1.0-SNAPSHOT</version>
<name>kostisBot</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url>
<repositories>
<repository>
<id>dv8tion</id>
<name>m2-dv8tion</name>
<url>https://m2.dv8tion.net/releases</url>
</repository>
<repository>
<id>central</id>
<name>bintray</name>
<url>http://jcenter.bintray.com</url>
</repository>
</repositories>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>15</maven.compiler.source>
<maven.compiler.target>15</maven.compiler.target>
<!-- Use the latest version whenever possible. -->
<jackson.version>2.12.0</jackson.version>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/javax.json/javax.json-api -->
<dependency>
<groupId>javax.json</groupId>
<artifactId>javax.json-api</artifactId>
<version>1.1.4</version>
</dependency>
<dependency>
<groupId>com.codesnippets4all</groupId>
<artifactId>quick-json</artifactId>
<version>1.0.4</version> </dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path</artifactId>
<version>2.1.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.6</version>
</dependency>
<dependency>
<groupId>com.sedmelluq</groupId>
<artifactId>lavaplayer</artifactId>
<version>1.3.75</version>
</dependency>
<dependency>
<groupId>com.github.dhiraj072</groupId>
<artifactId>random-word-generator</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>com.jagrosh</groupId>
<artifactId>jda-utilities</artifactId>
<version>3.0.5</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>4.2.1_255</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
<configuration>
<descriptorRefs>
<!-- This tells Maven to include all dependencies -->
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>src.main.java.Kostis.App.java</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>15</source>
<target>15</target>
</configuration>
</plugin>
<plugin>
<groupId>com.heroku.sdk</groupId>
<artifactId>heroku-maven-plugin</artifactId>
<version>3.0.3</version>
<configuration>
<appName>kostisbot</appName>
<processTypes>
<web>java $JAVA_OPTS -cp target/classes:target/dependency/* src.main.java.Kostis.App.java</web>
</processTypes>
</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>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
`
My proc file looks like this:
web: java $JAVA_OPTS -cp target/classes:target/dependency/* src.main.java.Kostis.App.java
this is the path for Main App [here][1]
Way before i think main loaded but all the other classes failed:
[enter image description here][2]
I'd appreciate any help. I have been trying to run my app for a while now and nothing seems to be working.
Thanks in advance.
[1]: https://i.stack.imgur.com/kNQ0B.png
[2]: https://i.stack.imgur.com/WqMyz.png

Maven : no main manifest attribute, in target/xx.jar, Unable to execute jar file

Here is the pom.xml:
<?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>dl4j</groupId>
<artifactId>dl4j</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>example.JavaTestExample</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.deeplearning4j</groupId>
<artifactId>deeplearning4j-core</artifactId>
<version>1.0.0-beta3</version>
</dependency>
<dependency>
<groupId>org.nd4j</groupId>
<artifactId>nd4j-native-platform</artifactId>
<version>1.0.0-beta3</version>
</dependency>
<dependency>
<groupId>org.datavec</groupId>
<artifactId>datavec-api</artifactId>
<version>1.0.0-beta3</version>
</dependency>
<!-- You need the below dependency to use CodecRecordReader-->
<dependency>
<groupId>org.datavec</groupId>
<artifactId>datavec-data-codec</artifactId>
<version>1.0.0-beta3</version>
</dependency>
<!-- <dependency>
<groupId>org.bytedeco.javacpp-presets</groupId>
<artifactId>${moduleName}-platform</artifactId>
<version>${moduleVersion}-1.4.4</version>
</dependency>-->
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>javacv-platform</artifactId>
<version>1.4.4</version>
</dependency>
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>javacpp</artifactId>
<version>1.4.4</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.8.0-beta4</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.8.0-beta4</version>
</dependency>
<!-- You need the below dependency to use LocalTransformExecutor-->
<dependency>
<groupId>org.datavec</groupId>
<artifactId>datavec-local</artifactId>
<version>1.0.0-beta3</version>
</dependency>
</dependencies>
<!-- Uncomment to use snapshot version -->
<!--<repositories>
<repository>
<id>snapshots-repo</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy> <!– Optional, update daily –>
</snapshots>
</repository>
</repositories>-->
</project>
I wanted to run maven-assembly-plugin and create a jar file with all dependencies added to it. When I run java -jar jarfile.jar, I get the below error:
no main manifest attribute, in target/jarfile.jar
I went through several Stack Overflow posts for the same and tried all permutations and combinations. I tried adding both assembly and shade plugins. You can see the settings I have in my pom.xml above. I'm not really sure on how this is happening even though I added proper maven settings.
I verified that Java is running fine:
I verified whether I specified the main class correctly.
Everything looks fine for me except the results and I'm confused at the moment.
What might be going wrong? I expect some of them still mark the question as "duplicate", but I have been reading other posts and tried changing the settings accordingly. None of them worked.
Good quality question!
I think this will help achieve your goal.
This is what I use to build a clickable JavaFX Jar with all dependencies included.
This is using maven-jar-plugin and maven-shade-plugin rather than maven-assembly-plugin; Here is a good resource on the differences.
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>10</release>
</configuration>
</plugin>
<plugin>
<!-- I think you don't need this one -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>${mainClass}</mainClass>
</configuration>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>
${mainClass}
</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ApacheLicenseResourceTransformer" />
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>${mainClass}</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

Maven NumberFormatException when packaging

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

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