Version combination (Maven / Log4J in Java 9 Jigsaw project) - java

I am trying to get a very simple JavaFX application to run with maven and Java 10 in IntelliJ.
The project:
https://github.com/ClanWolf/C3-Client_Phoenix
The structure:
The module-info.java:
module net.clanwolf.c3.client {
requires javafx.graphics;
requires javafx.fxml;
requires javafx.controls;
requires javafx.base;
requires org.apache.logging.log4j;
exports net.clanwolf.c3.client;
}
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>net.clanwolf.c3</groupId>
<artifactId>C3-Client_Phoenix</artifactId>
<version>4.6.2</version>
<packaging>jar</packaging>
<name>C3-Client Phoenix</name>
<url>http://c3.clanwolf.net</url>
<organization>
<name>ClanWolf W-7</name>
<url>http://www.clanwolf.net</url>
</organization>
<description>Starsystem map of the Inner Sphere, Periphery and Clan space (BattleTech).</description>
<prerequisites>
<maven>3.5.3</maven>
<!--<maven>3.3.9</maven>-->
</prerequisites>
<!-- Repositories ############################################################################################## -->
<repositories>
<repository>
<id>mvnrepository</id>
<name>mvnrepository</name>
<url>http://www.mvnrepository.com</url>
</repository>
<repository>
<id>mvncentral</id>
<name>mvncentral</name>
<url>http://central.maven.org/maven2/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>oss-sonatype-snapshots</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<!-- Properties ################################################################################################ -->
<properties>
<!-- __________________________________________________________ Versions -->
<java.version>10</java.version>
<maven.compiler.plugin.version>3.7.0</maven.compiler.plugin.version>
<maven.surefire.plugin.version>2.22.0</maven.surefire.plugin.version>
<junit.version>4.12</junit.version>
<junit.jupiter.version>5.2.0</junit.jupiter.version>
<junit.platform.surefire.provider.version>1.2.0</junit.platform.surefire.provider.version>
<asm.version>6.2</asm.version>
<!-- __________________________________________________________ Encoding -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<mainClass>net.clanwolf.c3.client.MainFrame</mainClass>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
</properties>
<!-- Dependencies ############################################################################################## -->
<dependencies>
<!-- _____________________________________________________________ Maven -->
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.plugin.version}</version>
</dependency>
<!-- _____________________________________________________________ JUnit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apiguardian</groupId>
<artifactId>apiguardian-api</artifactId>
<version>1.0.0</version>
<scope>test</scope>
</dependency>
<!-- ___________________________________________________________ Logging -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.11.0</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.11.0</version>
</dependency>
<!-- _______________________________________________ Tektosyne / Voronoi -->
<dependency>
<groupId>org.kynosarges</groupId>
<artifactId>tektosyne</artifactId>
<version>6.2.0</version>
</dependency>
<!-- ______________________________________________________ C3-Preloader -->
<dependency>
<groupId>net.clanwolf</groupId>
<artifactId>C3-Preloader</artifactId>
<version>1.0.0</version>
</dependency>
<!-- ____________________________________________________________ Nadron -->
<!--<dependency>-->
<!--<groupId>com.github.menacher</groupId>-->
<!--<artifactId>nadron</artifactId>-->
<!--<version>0.8-SNAPSHOT</version>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>com.github.menacher</groupId>-->
<!--<artifactId>nadclient</artifactId>-->
<!--<version>0.8-SNAPSHOT</version>-->
<!--</dependency>-->
<!-- _________________________________________________________ Hibernate -->
<!--<dependency>-->
<!--<groupId>org.hibernate.javax.persistence</groupId>-->
<!--<artifactId>hibernate-jpa-2.1-api</artifactId>-->
<!--<version>1.0.0.Final</version>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>org.hibernate</groupId>-->
<!--<artifactId>hibernate-core</artifactId>-->
<!--<version>5.0.3.Final</version>-->
<!--</dependency>-->
<!-- ___________________________________________________________________________ C H E C K I F N E E D E D -->
<!--<dependency>-->
<!--<groupId>net.sourceforge.collections</groupId>-->
<!--<artifactId>collections-generic</artifactId>-->
<!--<version>4.01</version>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>com.google.code.gson</groupId>-->
<!--<artifactId>gson</artifactId>-->
<!--<version>2.4</version>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>commons-codec</groupId>-->
<!--<artifactId>commons-codec</artifactId>-->
<!--<version>1.10</version>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>dom4j</groupId>-->
<!--<artifactId>dom4j</artifactId>-->
<!--<version>1.6.1</version>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>commons-net</groupId>-->
<!--<artifactId>commons-net</artifactId>-->
<!--<version>3.3</version>-->
<!--</dependency>-->
</dependencies>
<!-- Build ##################################################################################################### -->
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/version.number</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<excludes>
<exclude>**/version.number</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.plugin.version}</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
<dependencies>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>${asm.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven.surefire.plugin.version}</version>
<dependencies>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-surefire-provider</artifactId>
<version>${junit.platform.surefire.provider.version}</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.jupiter.version}</version>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-surefire-provider</artifactId>
<version>1.2.0</version>
</dependency>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>${asm.version}</version>
</dependency>
</dependencies>
<configuration>
<parallel>methods</parallel>
<threadCount>10</threadCount>
<includes>
<include>**/Test*.java</include>
<include>**/*Test.java</include>
<include>**/*Tests.java</include>
<include>**/*TestCase.java</include>
</includes>
</configuration>
</plugin>
<plugin>
<groupId>com.zenjava</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>8.9.0-SNAPSHOT</version>
<configuration>
<mainClass>net.clanwolf.c3.client.MainFrame</mainClass>
<preLoader>c3_preloader.C3_Preloader</preLoader>
<verbose>true</verbose>
<bundleArguments>
<!-- MSI installer Options -->
<!-- https://docs.oracle.com/javase/9/tools/javapackager.htm#GUID-E51F9601-E121-4A50-BCA7-C7F8730078B2__WINDOWSEXEBUNDLERARGUMENTS-26C9A39C -->
<!-- Custonmize MSI installer -->
<!-- http://wixtoolset.org/documentation/manual/v3/wixui/wixui_customizations.html -->
<icon>target/classes/icon.ico</icon>
<installdirChooser>true</installdirChooser>
<module-path>target/classes</module-path>
<module>net.clanwolf.c3.client</module>
<!--<add-modules>module1,module2,module3</add-modules>-->
<!--<limit-modules>module1,module2,module3</limit-modules>-->
<!--<runtime /> Not working together with the above commands -->
</bundleArguments>
<!--<jfxMainAppJarName>${project.build.finalName}.jar</jfxMainAppJarName>-->
<identifier>${project.artifactId}</identifier>
<vendor>ClanWolf.net</vendor>
<!-- win.app | linux.app | mac.app | exe | msi | rpm | deb -->
<bundler>msi</bundler>
<nativeReleaseVersion>${project.version}</nativeReleaseVersion>
<needShortcut>true</needShortcut>
<needMenu>true</needMenu>
<appName>${project.artifactId}</appName>
<jvmArgs>
<jvmArg>-Xmx2g</jvmArg>
<jvmArg>-Djavafx.verbose=true</jvmArg>
<!--<jvmProperty>-DMyProperty=true</jvmProperty>-->
</jvmArgs>
<!--<jvmProperties>-->
<!--<UserProperty>foo</UserProperty>-->
<!--</jvmProperties>-->
<!--<userJvmArgs>-->
<!--<Argument3>AppCommand</Argument3>-->
<!--</userJvmArgs>-->
<!--<keyStoreAlias>example-user</keyStoreAlias>-->
<!--<keyStorePassword>example-password</keyStorePassword>-->
<allPermissions>false</allPermissions>
<manifestAttributes>
<Specification-Title>${project.name}</Specification-Title>
<Specification-Version>${project.version}</Specification-Version>
<Specification-Vendor>${project.organization.name}</Specification-Vendor>
<Implementation-Title>${project.name}</Implementation-Title>
<Implementation-Version>${project.version}</Implementation-Version>
<Implementation-Vendor-Id>${project.groupId}</Implementation-Vendor-Id>
<Implementation-Vendor>${project.organization.name}</Implementation-Vendor>
</manifestAttributes>
</configuration>
<executions>
<execution>
<id>create-jfxjar</id>
<phase>package</phase>
<goals>
<goal>build-jar</goal>
</goals>
</execution>
<execution>
<id>create-native</id>
<phase>package</phase>
<goals>
<goal>build-native</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
This does not run. The maven build completes without problems, but if I start it in IntelliJ, it gives me this:
Error occurred during initialization of boot layer
java.lang.module.ResolutionException: Modules maven.core and maven.artifact export package org.apache.maven.artifact.resolver.filter to module aether.impl
If I do remove the dependency for log4j-core, it will run, but it will complain at runtime that there is no implementation of log4j and that I should please add log4j-core. If I do that, the Resolution Bullshit is shown again. How can this be resolved, if possible at all?

Java 9 modularization came with a couple of new rules like: Split packages, i.e. classes with the same package but in different jars, are not allowed. This is only an issue when working on the modulepath, not with the traditional classpath.
It seems like intellij decides for the wrong reason to switch to the modulepath, probably because log4j has a module descriptor.

After all the problem was that maven-compiler-plugin was in the pom.xml as a dependency. That is not necessary as it is only used during packaging. After I removed it, the errors went away.

Related

Cannot download artifact cas-server-core from https://mvnrepository.com/

I have problem with downloading cas-server-core from https://mvnrepository.com/.When I try to add repository https://mvnrepository.com, maven ignore it and try to download artifact from artifactory, where it isnt present. My build.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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.dhl.cas</groupId>
<artifactId>cas</artifactId>
<packaging>war</packaging>
<name>cas</name>
<version>3.0.10.0</version>
<parent>
<groupId>com.cleverlance.dhl.spc</groupId>
<artifactId>spc-parent</artifactId>
<version>0.3</version>
</parent>
<scm>
<developerConnection>
scm:svn:https://teamforge.dhl.com/svn/repos/SPL_APPL_TOOLBOX/cas-server/src/tags/cas-3.0.10.0
</developerConnection>
<connection>scm:svn:https://teamforge.dhl.com/svn/repos/SPL_APPL_TOOLBOX/cas-server/src/tags/cas-3.0.10.0
</connection>
<url>https://teamforge.dhl.com/svn/repos/SPL_APPL_TOOLBOX/cas-server/src/tags/cas-3.0.10.0</url>
</scm>
<prerequisites>
<maven>3.0.4</maven>
</prerequisites>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<hibernate.version>4.1.0.Final</hibernate.version>
<spring.version>4.2.3.RELEASE</spring.version>
<cas.version>3.5.0</cas.version>
<netbeans.hint.deploy.server>Tomcat</netbeans.hint.deploy.server>
<ojdbc7>12.1.0.1.0</ojdbc7>
<authentication.core.version>1.0.9.0</authentication.core.version>
<mysql.connector.version>5.1.44</mysql.connector.version>
</properties>
<build>
<resources>
<resource>
<filtering>false</filtering>
<directory>${basedir}/src/main/java</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
<resource>
<filtering>true</filtering>
<directory>${basedir}/src/main/resources</directory>
<includes>
<include>dct.properties</include>
</includes>
</resource>
<resource>
<filtering>false</filtering>
<directory>${basedir}/src/main/resources</directory>
</resource>
</resources>
<testResources>
<testResource>
<filtering>false</filtering>
<directory>${basedir}/src/test/resources</directory>
</testResource>
</testResources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<configuration>
<sourcepath>${basedir}/dummy</sourcepath>
</configuration>
</plugin>
<!-- add src/main/generated for maven -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>src/main/generated</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<version>2.0.2</version>
<inherited>true</inherited>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<warName>cas</warName>
<webResources>
<resource>
<directory>${basedir}/src/main/webapp</directory>
<filtering>true</filtering>
</resource>
</webResources>
<nonFilteredFileExtensions>
<nonFilteredFileExtension>xls</nonFilteredFileExtension>
</nonFilteredFileExtensions>
<overlays>
<overlay>
<groupId>org.jasig.cas</groupId>
<artifactId>cas-server-webapp</artifactId>
<excludes>
<!-- <exclude>**/spring-configuration,**/unused-spring-configuration,**/cas-servlet.xml</exclude> -->
<exclude>WEB-INF/unused-spring-configuration/**</exclude>
<exclude>WEB-INF/spring-configuration/**</exclude>
<exclude>**/cas-servlet.xml</exclude>
<exclude>**/deployerConfigContext.xml</exclude>
<exclude>**/login-webflow.xml</exclude>
<exclude>**/log4j.xml</exclude>
</excludes>
</overlay>
</overlays>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.9</version>
<configuration>
<argLine>-Duser.timezone=Etc/GMT</argLine>
</configuration>
</plugin>
<!-- <plugin> -->
<!-- <groupId> org.jasig.cas</groupId> -->
<!-- <artifactId>cas-server-webapp</artifactId> -->
<!-- <configuration> -->
<!-- <skip>true</skip> -->
<!-- </configuration> -->
<!-- </plugin> -->
</plugins>
</pluginManagement>
</build>
<dependencies>
<!-- Spring -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
</dependency>
<dependency>
<groupId>com.dhl.resp</groupId>
<artifactId>authentication-core</artifactId>
<version>${authentication.core.version}</version>
</dependency>
<!-- test -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<!-- hibernate -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${hibernate.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>${hibernate.version}</version>
</dependency>
<!-- CAS SSO -->
<dependency>
<groupId>org.jasig.cas</groupId>
<artifactId>cas-server-webapp</artifactId>
<type>war</type>
</dependency>
<dependency>
<groupId>com.github.inspektr</groupId>
<artifactId>inspektr-audit</artifactId>
<version>1.0.7.GA</version>
</dependency>
<dependency>
<groupId>com.github.inspektr</groupId>
<artifactId>inspektr-common</artifactId>
<version>1.0.7.GA</version>
</dependency>
<dependency>
<groupId>com.github.inspektr</groupId>
<artifactId>inspektr-support-spring</artifactId>
<version>1.0.7.GA</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-cas</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- JSP -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</dependency>
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
</dependency>
<!-- database -->
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</dependency>
<!-- oracle driver -->
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc7</artifactId>
<version>${ojdbc7}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>2.2.9</version>
<scope>test</scope>
</dependency>
<!-- tools -->
<dependency>
<groupId>net.sf.opencsv</groupId>
<artifactId>opencsv</artifactId>
<version>2.0</version>
</dependency>
<!-- SAML -->
<dependency>
<groupId>org.jasig.cas</groupId>
<artifactId>cas-server-core</artifactId>
<version>6.5.5</version>
<exclusions>
<exclusion>
<groupId>org.opensaml</groupId>
<artifactId>opensaml</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>${spring.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.security.extensions</groupId>
<artifactId>spring-security-saml2-core</artifactId>
<version>1.0.0.RELEASE</version>
<scope>compile</scope>
</dependency>
<!-- http client utils -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.4</version>
</dependency>
</dependencies>
<distributionManagement>
<repository>
<id>releases</id>
<url>http://czcholstc000112.prg-dc.dhl.com:8272/nexus/content/repositories/releases</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<url>http://czcholstc000112.prg-dc.dhl.com:8272/nexus/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>maven-release</name>
<url>https://artifactory.dhl.com/maven-release</url>
</repository>
<repository>
<snapshots/>
<id>snapshots</id>
<name>maven-snapshot</name>
<url>https://artifactory.dhl.com/maven-snapshot</url>
</repository>
<repository>
<snapshots/>
<id>mavenrepository</id>
<name>maven-repository</name>
<url>https://mvnrepository.com/</url>
</repository>
</repositories>
<profiles>
<profile>
<id>mysql</id>
<dependencies>
<!-- mysql driver -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.connector.version}</version>
</dependency>
</dependencies>
</profile>
</profiles>
</project>
Can someone give me a point how to solve this issue? I think that it is enough to add repository in pom.xml, but It seems that there is some problem, which I dont know. Thank you
I think you have wrong groupId
<groupId>org.jasig.cas</groupId> <artifactId>cas-server-core</artifactId> <version>6.5.5</version>
For the group you have versions are listed here
https://mvnrepository.com/artifact/org.jasig.cas/cas-server-core
If you want 6.5.5 version, shouldn't it be this one?
https://mvnrepository.com/artifact/org.apereo.cas/cas-server-core/6.5.5

flink: Could not initialize class org.apache.hadoop.hdfs.protocol.HdfsConstants

To write data to hdfs, I added flink-connector-filesystem_2.11 to my pom, so I can use BucketingSink.
When I submit my jar to flink cluster, it does write some message to hdfs. While, after a few minutes, the exception was thrown.
By jar tvf show-event-to-kafka/target/show-event-to-kafka-1.0-SNAPSHOT.jar | grep HdfsConstants.class, I foundHdfsConstants does exist.
How to fix it?
StackTrace:
TimerException{java.io.IOException: DataStreamer Exception: }
at org.apache.flink.streaming.runtime.tasks.SystemProcessingTimeService$TriggerTask.run(SystemProcessingTimeService.java:288)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.io.IOException: DataStreamer Exception:
at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer.run(DFSOutputStream.java:695)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.apache.hadoop.hdfs.protocol.HdfsConstants
at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer.createBlockOutputStream(DFSOutputStream.java:1413)
at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer.nextBlockOutputStream(DFSOutputStream.java:1357)
at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer.run(DFSOutputStream.java:587)
POM:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mafengwo.recommend.rtp</groupId>
<artifactId>parent-project</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<modules>
<module>quick-start</module>
<module>flink-template</module>
<module>feature-calculate</module>
<module>show-event-to-kafka</module>
<module>monitor</module>
<module>page-event-to-redis</module>
</modules>
<properties>
<applicationName>recommend-rtp</applicationName>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<flink.version>1.6.0</flink.version>
<scala.binary.version>2.11</scala.binary.version>
<java.version>1.8</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
</properties>
<dependencies>
<!-- flink -->
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-java</artifactId>
<version>${flink.version}</version>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-streaming-java_${scala.binary.version}</artifactId>
<version>${flink.version}</version>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-core</artifactId>
<version>${flink.version}</version>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-connector-kafka-0.8_2.11</artifactId>
<version>${flink.version}</version>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-connector-filesystem_2.11</artifactId>
<version>${flink.version}</version>
</dependency>
<!-- json -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.5</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>2.9.7</version>
</dependency>
<!-- test -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.1.0</version>
<scope>test</scope>
</dependency>
<!-- log -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.11.1</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.11.1</version>
</dependency>
<!-- redis -->
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>2.9.0</version>
</dependency>
<!-- statistic -->
<dependency>
<groupId>com.tdunning</groupId>
<artifactId>t-digest</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>com.mafengwo.recommend</groupId>
<artifactId>common</artifactId>
<version>1.30</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
<version>1.6</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.18</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<!-- 将properties和xml文件中,${...}格式的变量,替换成pom文件中定义的变量 -->
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
<plugins>
<!-- We use the maven-shade plugin to create a fat jar that contains all necessary dependencies. -->
<!-- Change the value of <mainClass>...</mainClass> if your program entry point changes. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.0.0</version>
<executions>
<!-- Run shade goal on package phase -->
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<excludes>
<exclude>org.apache.flink:force-shading</exclude>
<exclude>com.google.code.findbugs:jsr305</exclude>
<exclude>org.slf4j:*</exclude>
<exclude>log4j:*</exclude>
</excludes>
</artifactSet>
<filters>
<filter>
<!-- Do not copy the signatures in the META-INF folder.
Otherwise, this might cause SecurityExceptions when using the JAR. -->
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>
com.mafengwo.FlinkEntry
</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
</plugin>
</plugins>
</build>
<distributionManagement>
<repository>
<id>nexus-releases</id>
<name>Nexus Release Repository</name>
<url>https://nexus.mfwdev.com/repository/recommend-release/</url>
</repository>
<snapshotRepository>
<id>nexus-snapshots</id>
<name>Nexus Snapshots Repository</name>
<url>https://nexus.mfwdev.com/repository/recommend-snapshots/</url>
</snapshotRepository>
</distributionManagement>
<repositories>
<repository>
<id>nexus-releases</id>
<name>Nexus Release Repository</name>
<url>https://nexus.mfwdev.com/repository/recommend-release/</url>
</repository>
</repositories>
</project>
I solved this problem by clearly specifying the configuration of checkpoints in "flink-conf.yaml". The version of flink is 1.8.2.
state.backend: filesystem
state.checkpoints.dir: hdfs://<ip>:<port>/flink-checkpoints
state.savepoints.dir: hdfs://<ip>:<port>/flink-checkpoints

Integration test with maven

I want to be able to run Unit tests and integration tests separately.
The problem is that even though from my child pom.xml I specify that, when I run:
mvn verify -P integration-test
I want to just run the tests in src/it/java, but it just executes all the tests.
My directories are:
edms-pro
pom.xml (the general one)
...
rest-servides
src
it
java
resources
pom.xml (the child one)
pom.xml (the child one)
<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>com.everis</groupId>
<artifactId>edms-pro</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<name>Big Content Services</name>
<artifactId>rest-services</artifactId>
<packaging>jar</packaging>
<properties>
<skip.unit.tests>false</skip.unit.tests>
<skip.integration.tests>true</skip.integration.tests>
</properties>
<profiles>
<profile>
<id>dev</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<profile>
<id>integration-test</id>
<properties>
<!--
Only integration tests are run when the integration-test profile is active
-->
<skip.integration.tests>false</skip.integration.tests>
<skip.unit.tests>true</skip.unit.tests>
</properties>
</profile>
</profiles>
<dependencies>
<!-- Spring components -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>io.prometheus</groupId>
<artifactId>simpleclient_spring_boot</artifactId>
<version>${prometheus.version}</version>
</dependency>
<dependency>
<groupId>io.prometheus</groupId>
<artifactId>simpleclient_hotspot</artifactId>
<version>${prometheus.version}</version>
</dependency>
<dependency>
<groupId>com.ryantenney.metrics</groupId>
<artifactId>metrics-spring</artifactId>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${swagger2.version}</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${swagger2.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- Lombok Java extensions -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
<!-- Apache Commons -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<!-- JSR-305 annotations for Software Defect Detection -->
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
</dependency>
<!-- Google Guava core libraries for Java -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<!-- Logging -->
<dependency>
<groupId>net.logstash.logback</groupId>
<artifactId>logstash-logback-encoder</artifactId>
</dependency>
<!-- Apache http components -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
</dependency>
<!-- Testing -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.everis</groupId>
<artifactId>edms-mocks</artifactId>
<version>${com.everis.edms.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>com.everis</groupId>
<artifactId>edms-backend-couchbase</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20160810</version>
</dependency>
<dependency>
<groupId>com.auth0</groupId>
<artifactId>java-jwt</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>adal4j</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.everis</groupId>
<artifactId>multitenancy-test</artifactId>
<version>${com.everis.edms.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<classifier>${dist.classifier}</classifier>
</configuration>
</plugin>
<!-- A partir d'aqui afegir per Hector respecte diseny original-->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<!--<version>1.12</version> -->
<executions>
<execution>
<id>add-integration-test-sources</id>
<phase>generate-test-sources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<!-- Configures the source directory of our integration tests -->
<sources>
<source>src/it/java</source>
</sources>
</configuration>
</execution>
<!-- Add a new resource directory to our build -->
<execution>
<id>add-integration-test-resources</id>
<phase>generate-test-resources</phase>
<goals>
<goal>add-test-resource</goal>
</goals>
<configuration>
<!-- Configures the resource directory of our integration tests -->
<resources>
<resource>
<filtering>true</filtering>
<directory>src/it/resources</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<!--<version>3.5</version> -->
<configuration>
<!--<source>${jdk.version}</source>
<target>${jdk.version}</target> -->
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<!--<version>2.19.1</version> -->
<configuration>
<!--<groups>com.testwithspring.intermediate.unittests.UnitTest</groups>-->
<!--
Skips unit tests if the value of skip.unit.tests
property is true
-->
<skipTests>${skip.unit.tests}</skipTests>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${maven-failsafe-plugin.version}</version>
<executions>
<execution>
<!--<id>integration-tests</id>-->
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<testSourceDirectory>src/it/java</testSourceDirectory>
<!--
<includes>
<include>src/it/*.java</include>
</includes> -->
<!--<groups>com.testwithspring.intermediate.integrationtests.IntegrationTest</groups>-->
<!--
Skips integration tests if the value of skip.integration.tests
property is true
-->
<skipTests>${skip.integration.tests}</skipTests>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
I run mvn verify -P integration-test from the main directory and I would like just to test the scripts inside the folders called "it".
Here's what we do on my projects.
First, /src/it/java is non-standard, so we put all test source under /src/test/java.
With a shared test source root directory, you can keep integration tests and unit test separate by adopting a naming convention for your test classes. For example, *UT.java, or UT_*.java for unit tests, and *IT.java or IT_*.java for integration tests.
Then, you can use both the includes/excludes options on the failsafe and surefire plug-ins to execute the correct tests in each. In the surefire plugin, include only the UT sources, and exclude the IT sources. In failsafe, simply do the opposite.
For example:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<!--<version>2.19.1</version> -->
<configuration>
<includes>
<include>**/*UT.java</include>
</includes>
<excludes>
<exclude>**/*IT.java</exclude>
</excludes>
<skipTests>${skip.unit.tests}</skipTests>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${maven-failsafe-plugin.version}</version>
<executions>
<execution>
<!--<id>integration-tests</id>-->
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<includes>
<include>**/*IT.java</include>
</includes>
<excludes>
<exclude>**/*UT.java</exclude>
</excludes>
<skipTests>${skip.integration.tests}</skipTests>
</configuration>
</execution>
</executions>
</plugin>

Maven obfuscation with ProGuard

I have recently created a JAR file that needs obfuscation, but I cannot seem to get it working what so ever. Either it throws a bunch of warnings about not found references, duplications or it just doesn't obfuscate anything at all. I'm using the Maven Proguard plugin.
Maven build log: https://hastebin.com/oneyozizoh.hs
It says build succeed but it is not what I'm looking for: it does not include the external dependencies (influxDB) and it's not even obfuscated.
Here's the deal:
It uses external libraries such as InfluxDB. This needs to be included in JAR upon exporting. The plugin will not work without it. These external libs should not be obfuscated (unless there's a way to obfuscate every single required dependency as well and still have it work).
It also uses some other JAR files as optional dependencies (scope system or provided). These are NOT included in the export JAR. These libraries should not be obfuscated what so ever as they are resolved at runtime (if present).
It would most likely be the easiest if only my project package gets obfuscated, which is com.dyescape.*. I have tried this but I cannot seem to get it working.
Here is the pom.xml file I have so far.
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.dyescape</groupId>
<artifactId>ServerStatistics</artifactId>
<version>1.0.0</version>
<name>ServerStatistics</name>
<description>A plugin that gathers server statistics and pushes them to an external panel.</description>
<url>https://www.dyescape.com</url>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>vault-repo</id>
<url>http://nexus.hc.to/content/repositories/pub_releases</url>
</repository>
<repository>
<id>viaversion-repo</id>
<url>https://repo.viaversion.com</url>
</repository>
<repository>
<id>votifier-repo</id>
<url>http://repo.howaner.de/com/vexsoftware/votifier/1.9/</url>
</repository>
<repository>
<id>minebuilders-repo</id>
<url>http://minebuilders.me:8080/plugin/repository/everything/</url>
</repository>
</repositories>
<dependencies>
<!--Spigot API-->
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.12-R0.1-SNAPSHOT</version>
<scope>provided</scope>
<exclusions>
<exclusion> <!-- declare the exclusion here -->
<groupId>sample.ProjectB</groupId>
<artifactId>Project-B</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.influxdb</groupId>
<artifactId>influxdb-java</artifactId>
<version>2.7</version>
</dependency>
<dependency>
<groupId>net.milkbowl.vault</groupId>
<artifactId>VaultAPI</artifactId>
<version>1.6</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.MassiveCraft</groupId>
<artifactId>MassiveCore</artifactId>
<version>2.13.2</version>
<scope>system</scope>
<systemPath>${project.basedir}/MassiveCore.jar</systemPath>
</dependency>
<dependency>
<groupId>com.MassiveCraft</groupId>
<artifactId>Factions</artifactId>
<version>2.13.2</version>
<scope>system</scope>
<systemPath>${project.basedir}/Factions.jar</systemPath>
</dependency>
<dependency>
<groupId>me.leoko.advancedban</groupId>
<artifactId>AdvancedBan</artifactId>
<version>2.1.1</version>
<scope>system</scope>
<systemPath>${project.basedir}/AdvancedBan.jar</systemPath>
</dependency>
<dependency>
<groupId>fr.neatmonster.nocheatplus</groupId>
<artifactId>NoCheatPlus</artifactId>
<version>3.15.1-RC-sMD5NET-b1084</version>
<scope>system</scope>
<systemPath>${project.basedir}/NoCheatPlus.jar</systemPath>
</dependency>
<dependency>
<groupId>us.myles</groupId>
<artifactId>viaversion</artifactId>
<scope>provided</scope>
<version>1.2.0-17w31a-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.vexsoftware</groupId>
<artifactId>votifier</artifactId>
<version>1.9</version>
<scope>system</scope>
<systemPath>${project.basedir}/Votifier.jar</systemPath>
</dependency>
<dependency>
<groupId>com.gmail.nossr50</groupId>
<artifactId>mcMMO</artifactId>
<version>1.5.08-SNAPSHOT</version>
<scope>system</scope>
<systemPath>${project.basedir}/mcMMO.jar</systemPath>
</dependency>
<dependency>
<groupId>me.konsolas</groupId>
<artifactId>aac</artifactId>
<version>3.3.0-b1</version>
<scope>system</scope>
<systemPath>${project.basedir}/AAC.jar</systemPath>
</dependency>
<dependency>
<groupId>PAC</groupId>
<artifactId>PAC</artifactId>
<version>1.2.1</version>
<scope>system</scope>
<systemPath>${project.basedir}/PAC.jar</systemPath>
</dependency>
<dependency>
<groupId>de.Keyle</groupId>
<artifactId>MyPet</artifactId>
<version>2.3.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/MyPet.jar</systemPath>
</dependency>
<dependency>
<groupId>me.minebuilders</groupId>
<artifactId>clearlag-core</artifactId>
<version>2.9.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
<!-- Build -->
<build>
<!-- Resources -->
<sourceDirectory>src/main/java</sourceDirectory>
<defaultGoal>clean install</defaultGoal>
<resources>
<resource>
<directory>src/main/resources</directory>
<!-- Keeping filtering at true here reduces plugin.yml redundancy! -->
<filtering>true</filtering>
<includes>
<include>plugin.yml</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<!-- Keep filtering at false for other resources to prevent bad magic -->
<filtering>false</filtering>
<excludes>
<exclude>**/*.java</exclude>
<exclude>plugin.yml</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>fully.qualified.MainClass</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
<plugin>
<groupId>com.github.wvengen</groupId>
<artifactId>proguard-maven-plugin</artifactId>
<version>2.0.14</version>
<dependencies>
<dependency>
<groupId>net.sf.proguard</groupId>
<artifactId>proguard-base</artifactId>
<version>5.3.3</version>
</dependency>
</dependencies>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>proguard</goal>
</goals>
</execution>
</executions>
<configuration>
<proguardVersion>5.3.3</proguardVersion>
<options>
<option>-dontshrink</option>
<option>-dontoptimize</option>
<option>-keep class !com.dyescape.**,com.dyescape.serverstatistics.ServerStatistics { *; }</option>
<option>-keepattributes Exceptions,InnerClasses,Signature,Deprecated,SourceFile,LineNumberTable,LocalVariable*Table,*Annotation*,Synthetic,EnclosingMethod,*Annotations*</option>
</options>
<libs>
<lib>${java.home}/lib/rt.jar</lib>
<lib>${java.home}/lib/jce.jar</lib>
</libs>
</configuration>
</plugin>
</plugins>
</build>
</project>
The command I used to use to build the JAR (including required dependencies) is the following:
clean package assembly:single

LIbrary not loading in gae serverside

I have a simple library which contains this file:
import java.util.Date;
public class DateUtils {
public static Date addDays(Date date, int days) {
assert date != null : "Date cannont be null";
return new Date(date.getYear(), date.getMonth(), date.getDate() + days);
}
}
This is run a with gwt. I call this function in the server and in the client. It works perfectly in development mode. When I upload it to gae it only works on the client side.
Error log says org.jboss.resteasy.spi.UnhandledException: java.lang.NoClassDefFoundError: com/mt/utilities/shared/DateUtils
pom.xml added
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mt.ba</groupId>
<artifactId>basicapp</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>GWTP Basic with GXT</name>
<description>Basic GWTP application with the GXT library</description>
<properties>
<!-- client -->
<!-- Get the latest GXT release through support 3.0.6... -->
<gxt.version>3.0.1</gxt.version>
<gwt.version>2.5.1</gwt.version>
<gwtp.version>1.1.1</gwtp.version>
<gin.version>2.0.0</gin.version>
<!-- server -->
<guice.version>3.0</guice.version>
<!-- REST -->
<resteasy.version>3.0.2.Final</resteasy.version>
<arcbees.version>1.1.1</arcbees.version>
<!-- testing -->
<junit.version>4.11</junit.version>
<!--
<jukito.version>1.3</jukito.version>
-->
<!-- maven -->
<gwt-maven-plugin.version>2.5.1</gwt-maven-plugin.version>
<maven-surefire-plugin.version>2.6</maven-surefire-plugin.version>
<maven-compiler-plugin.version>2.3.2</maven-compiler-plugin.version>
<maven-resources-plugin.version>2.5</maven-resources-plugin.version>
<maven-processor-plugin.version>2.0.5</maven-processor-plugin.version>
<maven-build-helper-plugin.version>1.7</maven-build-helper-plugin.version>
<target.jdk>1.7</target.jdk>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
<!-- GAE -->
<gae.version>1.8.8</gae.version>
<gae.home>${settings.localRepository}/com/google/appengine/appengine-java-sdk/${gae.version}/appengine-java-sdk-${gae.version}</gae.home>
<!-- mt Libraries -->
<mt.rest>0.3.1</mt.rest>
<mt.utilities>0.1.3</mt.utilities>
</properties>
<build>
<outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>
<plugins>
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>${gae.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>${target.jdk}</source>
<target>${target.jdk}</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<!-- JUnit Testing - skip *.GwtTest cases -->
<!-- 'mvn test' - runs the Junit tests -->
<!-- 'mvn integration-test` - runs GWT test cases -->
<!-- 'mvn integration-test -P selenium-local` - runs GWT selenium unit test cases -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<includes>
<include>**/*Test.java</include>
</includes>
<excludes>
<exclude>**/*GwtTest.java</exclude>
</excludes>
</configuration>
</plugin>
<!-- GWT -->
<!-- 'mvn gwt:run' - runs development mode -->
<!-- 'mvn gwt:debug' - runs debug mode -->
<!-- 'mvn gwt:compile' - compiles gwt -->
<!-- 'mvn integration-test' - runs the gwt tests (*GwtTest.java) -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>${gwt.version}</version>
<configuration>
<gwtSdkFirstInClasspath>true</gwtSdkFirstInClasspath>
<strict>true</strict>
<testTimeOut>180</testTimeOut>
<includes>**/*GwtTestSuite.java</includes>
<excludes>**/*GwtTest.java</excludes>
<mode>htmlunit</mode>
<extraJvmArgs>-Xss1024K -Xmx1024M -XX:MaxPermSize=256M</extraJvmArgs>
<logLevel>INFO</logLevel>
<style>${gwt.style}</style>
<copyWebapp>true</copyWebapp>
<hostedWebapp>${webappDirectory}</hostedWebapp>
<runTarget>ba.html</runTarget>
<modules>
<module>com.mt.ba.ba</module>
</modules>
</configuration>
<executions>
<execution>
<goals>
<goal>test</goal>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>RestLibrary</id>
<url>https://dl.dropboxusercontent.com/u/45032161/mvn-repository/com/mt/rest/restlibrary/${mt.rest}/restlibrary-${mt.rest}.jar</url>
</repository>
<repository>
<id>UtilitiesLibrary</id>
<url>https://dl.dropboxusercontent.com/u/45032161/mvn-repository/com/mt/utilities/utilitieslibrary/${mt.utilities}/utilitieslibrary-${mt.utilities}.jar</url>
</repository>
</repositories>
<!-- Get the latest release through support, 3.0.6... -->
<!-- <repositories> -->
<!-- <repository> -->
<!-- ~/.m2/settings.xml add <server/> with same id here with login credentials -->
<!-- <id>sencha-gxt-repository</id> -->
<!-- <name>Sencha GXT Repository</name> -->
<!-- Support Subscribers Only: Subscribe to support for -->
<!-- Latest GPL Support GXT Versions -->
<!-- <url>https://maven.sencha.com/repo/gxt-support-gpl-release</url> -->
<!-- Commercial Support GXT Versions -->
<!-- <url>https://maven.sencha.com/repo/gxt-commercial-release</url> -->
<!-- </repository> -->
<!-- </repositories> -->
<dependencies>
<!-- mt Libraries -->
<dependency>
<groupId>com.mt.rest</groupId>
<artifactId>restlibrary</artifactId>
<version>${mt.rest}</version>
</dependency>
<dependency>
<groupId>com.mt.utilities</groupId>
<artifactId>utilitieslibrary</artifactId>
<version>${mt.utilities}</version>
</dependency>
<!-- GXT -->
<!-- http://docs.sencha.com/gxt-guides/3/ -->
<dependency>
<groupId>com.sencha.gxt</groupId>
<artifactId>gxt</artifactId>
<version>${gxt.version}</version>
</dependency>
<dependency>
<groupId>com.sencha.gxt</groupId>
<artifactId>gxt-chart</artifactId>
<version>${gxt.version}</version>
</dependency>
<!-- Google Web Toolkit -->
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwt.version}</version>
</dependency>
<!-- GWT-Platform -->
<dependency>
<groupId>com.gwtplatform</groupId>
<artifactId>gwtp-mvp-client</artifactId>
<version>${gwtp.version}</version>
</dependency>
<!-- AppEngine -->
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-1.0-sdk</artifactId>
<version>${gae.version}</version>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>${gwt.version}</version>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
<version>${gwt.version}</version>
</dependency>
<!-- DI -->
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>${guice.version}</version>
</dependency>
<dependency>
<groupId>com.google.inject.extensions</groupId>
<artifactId>guice-servlet</artifactId>
<version>${guice.version}</version>
</dependency>
<dependency>
<groupId>com.google.inject.extensions</groupId>
<artifactId>guice-assistedinject</artifactId>
<version>${guice.version}</version>
</dependency>
<dependency>
<groupId>com.google.gwt.inject</groupId>
<artifactId>gin</artifactId>
<version>${gin.version}</version>
</dependency>
<!-- Rest -->
<dependency>
<groupId>com.gwtplatform</groupId>
<artifactId>gwtp-dispatch-rest</artifactId>
<version>${gwtp.version}</version>
<scope>provided</scope>
</dependency>
<!-- Test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<!--
<dependency>
<groupId>org.jukito</groupId>
<artifactId>jukito</artifactId>
<version>${jukito.version}</version>
<scope>test</scope>
</dependency>
-->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-remote-driver</artifactId>
<version>2.33.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.33.0</version>
<scope>test</scope>
</dependency>
</dependencies>
<profiles>
<!-- run with 'mvn integration-test -P selenium-local' -->
<profile>
<id>selenium-local</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<configuration>
<mode>selenium</mode>
<productionMode>true</productionMode>
<selenium>localhost:4444/*firefox,localhost:4444/*opera</selenium>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Any suggestions?
Make sure your DateUtils code is uploaded to GAE.
You maybe have a War Server Project, and a Client Projet.
And you just deploy the War Server Projet to the serveur with just the GWT compiled files ?
The best is to have a shared project who is included in both project.

Categories

Resources