I'm new to JavaFX and I'm trying to build my first application, using Maven. Well, since I don't really like to mix ant with maven, I got an alternative solution, using exec-maven-plugin and javafxpackager, found here: http://www.oracle.com/technetwork/articles/java/enterprisefxpt3-1735081.html
Problem is, I don't like the way it unpacks all my dependencies inside the jar, so I modified it a "little", resulting on this:
<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>test</groupId>
<artifactId>test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<javafx.version>2.2</javafx.version>
</properties>
<build>
<finalName>test</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.4</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<includeScope>runtime</includeScope>
<outputDirectory>${project.build.directory}/classes</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>${java.home}/../bin/javafxpackager</executable>
<arguments>
<argument>-createjar</argument>
<argument>-appclass</argument>
<argument>test.HelloWorldApp</argument>
<argument>-srcdir</argument>
<argument>${project.build.directory}/classes</argument>
<argument>-outdir</argument>
<argument>${project.build.directory}/dist</argument>
<argument>-outfile</argument>
<argument>${project.name}.jar</argument>
</arguments>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>javafx</artifactId>
<version>${javafx.version}</version>
<scope>system</scope>
<systemPath>${java.home}/lib/jfxrt.jar</systemPath>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<type>jar</type>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Well, I think it really looks good, more than expected! Well, all but one "little" problem: I don't have the classpath entry on the Manifest.MF, so any dependencies added aren't found on runtime, and I have no clue how to add it. Any ideas?
Thanks all for the help!
EDIT: Maybe this can help, javafxpackager has an argument classpath that I can pass a list of dependencies. So what I need is the classpath, maybe as a String, just to add it to javafxpackager.
If you look at the exec-maven-plugin POM configuration you see that you can add a <classpath/> tag. I haven't tried it but it should do it.
<configuration>
<executable>${java.home}/../bin/javafxpackager</executable>
<arguments>
<argument>-createjar</argument>
<argument>-appclass</argument>
<argument>test.HelloWorldApp</argument>
<argument>-srcdir</argument>
<argument>${project.build.directory}/classes</argument>
<argument>-outdir</argument>
<argument>${project.build.directory}/dist</argument>
<argument>-outfile</argument>
<argument>${project.name}.jar</argument>
<argument>-classpath</argument>
<!-- automatically creates the classpath using all project dependencies,
also adding the project build directory -->
<classpath/>
</arguments>
</configuration>
check out this pom.xml for a personal javafx application
it does not use javafxpackager / javapackager, but is a perfect runnable jar. jar will be under target/${project.name}-${version}-jar-with-dependencies.jar
<build>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>src/</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.4.3</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target/dependency</outputDirectory>
<resources>
<resource>
<directory>lib</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>application.WeatherFXApplication</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>ant</groupId>
<artifactId>ant-apache-log4j</artifactId>
<version>1.6.5</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-jaxrs</artifactId>
<version>1.9.2</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>4.0.6.RELEASE</version>
</dependency>
</dependencies>
also is possible to obtain the same thing with shade plugin
<build>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>src/</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>application.WeatherFXApplication</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>ant</groupId>
<artifactId>ant-apache-log4j</artifactId>
<version>1.6.5</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-jaxrs</artifactId>
<version>1.9.2</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>4.0.6.RELEASE</version>
</dependency>
</dependencies>
Related
When I convert my xtext project to maven in eclipse, an recoginzed character (diomand question mark �) appread.
Before converting the project it was like this :
in the file MyLangGenerator.xtend
<?xml version='1.0' encoding='UTF-8'?>
<Entities>
«GetItem(entities)»
«IF isValid»
«GetFoo(entities)»
«ENDIF»
</Entities>
After converting to Maven it goes like this:
<?xml version='1.0' encoding='UTF-8'?>
<Entities>
�GetItem(entities)�
�IF isValid�
�GetFoo(entities)�
�ENDIF�
</Entities>
This my 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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.xtext.mypath</groupId>
<artifactId>org.xtext.mypath</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<xtextVersion>2.27.0</xtextVersion>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<SdlFileName>myfilename</SdlFileName>
</properties>
<build>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>src</directory>
<includes>
<include>**/*.java</include>
<include>**/*.xtend</include>
<include>**/*.xtext</include>
<include>**/*.mwe2</include>
<include>**/*.tokens</include>
<include>**/*.xtextbin</include>
</includes>
</resource>
<resource>
<directory>src-gen</directory>
<includes>
<include>**/*.java</include>
<include>**/*.xtend</include>
<include>**/*.xtext</include>
<include>**/*.mwe2</include>
<include>**/*.tokens</include>
<include>**/*.xtextbin</include>
</includes>
</resource>
<resource>
<directory>xtend-gen</directory>
<includes>
<include>**/*.java</include>
<include>**/*.xtend</include>
<include>**/*.xtext</include>
<include>**/*.mwe2</include>
<include>**/*.tokens</include>
<include>**/*.xtextbin</include>
</includes>
</resource>
<resource>
<directory>resources</directory>
<includes>
<include>**/*.properties</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>add-gen-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>src-gen</source>
</sources>
</configuration>
</execution>
<execution>
<id>add-extra-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>xtend-gen</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>org.xtext.mypath.generator.Main</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<finalName>${SdlFileName}</finalName>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
<executions>
<execution>
<id>make-assembly</id> <!-- this is used for inheritance merges -->
<phase>package</phase> <!-- bind to the packaging phase -->
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
</plugin>
<plugin>
<groupId>org.eclipse.xtend</groupId>
<artifactId>xtend-maven-plugin</artifactId>
<version>${xtextVersion}</version>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.codehaus.mojo
</groupId>
<artifactId>
exec-maven-plugin
</artifactId>
<versionRange>
[1.2.1,)
</versionRange>
<goals>
<goal>java</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
<dependency>
<groupId>org.eclipse.emf</groupId>
<artifactId>org.eclipse.emf.ecore</artifactId>
<version>2.6.0.v20100614-1136</version>
</dependency>
<dependency>
<groupId>org.eclipse.emf</groupId>
<artifactId>org.eclipse.emf.common</artifactId>
<version>2.20.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.emf</groupId>
<artifactId>org.eclipse.emf.mwe2.language</artifactId>
<version>2.13.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.xtend</groupId>
<artifactId>xtend-maven-plugin</artifactId>
<version>${xtextVersion}</version>
</dependency>
<dependency>
<groupId>org.eclipse.xtext</groupId>
<artifactId>org.eclipse.xtext</artifactId>
<version>${xtextVersion}</version>
</dependency>
<dependency>
<groupId>org.eclipse.xtext</groupId>
<artifactId>org.eclipse.xtext.xbase</artifactId>
<version>${xtextVersion}</version>
</dependency>
<dependency>
<groupId>org.eclipse.xtext</groupId>
<artifactId>org.eclipse.xtext.xtext.generator</artifactId>
<version>${xtextVersion}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>30.0-jre</version>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>5.0.1</version>
</dependency>
<dependency>
<groupId>javax.json</groupId>
<artifactId>javax.json-api</artifactId>
<version>1.1.4</version>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.json</artifactId>
<version>1.1.4</version>
</dependency>
<dependency>
<groupId>org.eclipse.emf</groupId>
<artifactId>org.eclipse.emf.ecore.xmi</artifactId>
<version>2.16.0</version>
</dependency>
</dependencies>
</project>
I've tried to look up for this issue but no luck! I think it is something related to Unicode?
I've figure out what the issue is
Huge thanks for mr mcwolf and Christian Dietrich for their hints.
the issue is that the original project was written in Widows-1256 so when I convert to maven, it automatically works in UTF-8 environment. So, I had to encode my maven to windows-1256 in order to meet the source project Unicode.
following this article , I've added the following to my Pom.xml
<properties>
<project.build.sourceEncoding>windows-1256</project.build.sourceEncoding>.
</properties>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<encoding>windows-1256</encoding>
</configuration>
</plugin>
attempting to build [RedFX-Quantum/Strange][1]. When running mvn package, I get "Fatal error compiling: invalid flag: --release". the pom.xml file is below:
<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>org.redfx</groupId>
<artifactId>strange</artifactId>
<packaging>jar</packaging>
<version>0.1.3</version>
<name>Strange</name>
<description>Strange Quantum Simulator</description>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<javadoc.plugin.version>3.2.0</javadoc.plugin.version>
<gpg.plugin.version>1.6</gpg.plugin.version>
</properties>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.5.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>5.5.2</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.5.2</version>
</dependency>
<!--
<dependency>
<groupId>org.nd4j</groupId>
<artifactId>nd4j-native</artifactId>
<version>1.0.0-beta7</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-nop</artifactId>
<version>1.7.26</version>
</dependency>
-->
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<release>10</release>
</configuration>
<dependencies>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>6.1.1</version> <!-- Use newer version of ASM -->
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>org.redfx.strange.demo.Demo</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<configuration>
<trimStackTrace>false</trimStackTrace>
</configuration>
</plugin>
<!--
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.7</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M3</version>
<executions>
<execution>
<id>enforce-no-snapshots</id>
<phase>install</phase>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireReleaseDeps>
<message>Snapshot dependencies are not allowed for release project version!</message>
<onlyWhenRelease>true</onlyWhenRelease>
</requireReleaseDeps>
</rules>
<fail>true</fail>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId>
<version>2.0.0</version>
<configuration>
<organizationName>Johan Vos</organizationName>
<inceptionYear>2020</inceptionYear>
<licenseName>bsd_3</licenseName>
<addJavaLicenseAfterPackage>false</addJavaLicenseAfterPackage>
</configuration>
</plugin>
</plugins>
</build>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
<profiles>
<profile>
<id>release</id>
<build>
<plugins>
<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-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${javadoc.plugin.version}</version>
<configuration>
<detectJavaApiLink>false</detectJavaApiLink>
<source>8</source>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.7</version>
<configuration>
<skip>false</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>${gpg.plugin.version}</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
<configuration>
<!-- This is necessary for gpg to not try to use the pinentry programs -->
<!-- Only required for GPG >= 2.2 -->
<!--
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
-->
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<scm>
<connection>scm:git:git://github.com/redfx-quantum/strange.git</connection>
<developerConnection>scm:git:git#github.com:redfx-quantum/strange.git</developerConnection>
<url>https://github.com/redfx-quantum/strange</url>
<tag>HEAD</tag>
</scm>
</project>
running mvn package -e didn't give any noticeably different output and mvn package -X didn't give me anything I could understand. How would I go about fixing it? Looking in the pom.xml file, the only release related thing I could see was the <release>10<\release> but idk what to change that to if that is the problem. I'm assuming I have to change things in the file to fit what versions of java and maven I have but I'm pretty new to the both of them and don't really know what I'm looking for.
[1]https://github.com/redfx-quantum/strange
as always, excuse me if I make a silly query or one that is easily resolved. In a project I'm working on I was asked to find out if it's possible to build two wars from one webapp. This I could solve in the following way:
WebProject
<artifactId>FacturaElectronica</artifactId>
<packaging>war</packaging>
<name>factElectronica - web</name>
<description>This is the web POM file</description>
<groupId>factElectronica-web</groupId>
<version>1.0-SNAPSHOT</version>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<executions>
<execution>
<id>default-install</id>
<phase>never</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.2</version>
<executions>
<execution>
<id>default-war</id>
<phase>none</phase>
<configuration>
<finalName>unwanted</finalName>
<classifier>unwanted</classifier>
</configuration>
</execution>
<execution>
<id>facturaelectronicafija</id>
<phase>install</phase>
<goals>
<goal>war</goal>
</goals>
<configuration>
<classifier>facturaelectronicafija</classifier>
<webResources>
<resource>
<filtering>true</filtering>
<directory>src/main/webapp</directory>
<includes>
<include>**</include>
</includes>
</resource>
<resource>
<directory>src/main/webapp</directory>
</resource>
</webResources>
<failOnMissingWebXml>false</failOnMissingWebXml>
<archive>
<manifestEntries>
<Dependencies>org.apache.santuario.xmlsec,org.apache.commons.codec,javax.ws.rs.api</Dependencies>
</manifestEntries>
</archive>
</configuration>
</execution>
<execution>
<id>facturaelectronicamovil</id>
<phase>install</phase>
<goals>
<goal>war</goal>
</goals>
<configuration>
<classifier>facturaelectronicamovil</classifier>
<webResources>
<resource>
<filtering>true</filtering>
<directory>src/main/webapp</directory>
<includes>
<include>**</include>
</includes>
</resource>
<resource>
<directory>src/main/webappFant</directory>
</resource>
</webResources>
<failOnMissingWebXml>false</failOnMissingWebXml>
<archive>
<manifestEntries>
<Dependencies>org.apache.santuario.xmlsec,org.apache.commons.codec,javax.ws.rs.api</Dependencies>
</manifestEntries>
</archive>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/java/resources</directory>
</resource>
</resources>
</build>
Each of these war has the same classes but differs in the xhtml files. One points to mobile phone components and the other points to landline phone components.
After doing this, I realized that it was necessary to build an ear for each one of them, each one with its root context and perform the deploy in wildfly. But I can't find the way to do it. On the one hand I don't know how to point to the wars that are built in the execution in the webapp, and on the other hand I don't know if the way is only with one ear for both or it is necessary to build two. I would be very grateful if someone could give me a hand with this. Thank you very much!
Update
Taking the example I found in this link: Maven ear plugin multiple artifacts content
I made the following changes:
WebProject
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<executions>
<execution>
<id>package-facturaelectronicafija</id>
<phase>package</phase>
<configuration>
<classifier>facturaelectronicafija</classifier>
<webappDirectory>${project.build.directory}/${project.build.finalName}-facturaelectronicafija</webappDirectory>
<webResources>
<resource>
<directory>src/main/webapp</directory>
</resource>
</webResources>
</configuration>
<goals>
<goal>war</goal>
</goals>
</execution>
<execution>
<id>package-facturaelectronicamovil</id>
<phase>package</phase>
<configuration>
<classifier>facturaelectronicamovil</classifier>
<webappDirectory>${project.build.directory}/${project.build.finalName}-facturaelectronicamovil</webappDirectory>
<webResources>
<resource>
<directory>src/main/webappFant</directory>
</resource>
</webResources>
</configuration>
<goals>
<goal>war</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
<finalName>FacturaElectronica</finalName>
</build>
</project>
EarProject
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>factElectronicaWeb-ear</groupId>
<artifactId>factElectronicaWeb-ear</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>ear</packaging>
<dependencies>
<dependency>
<groupId>factElectronica-web</groupId>
<artifactId>FacturaElectronica</artifactId>
<version>1.0-SNAPSHOT</version>
<type>war</type>
</dependency>
<dependency>
<groupId>factElectronica-web</groupId>
<artifactId>FacturaElectronica</artifactId>
<version>1.0-SNAPSHOT</version>
<classifier>facturaelectronicafija</classifier>
<scope>provided</scope>
<type>war</type>
</dependency>
<dependency>
<groupId>factElectronica-web</groupId>
<artifactId>FacturaElectronica</artifactId>
<classifier>facturaelectronicamovil</classifier>
<version>1.0-SNAPSHOT</version>
<scope>provided</scope>
<type>war</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<!-- <groupId>org.apache.maven.plugins</groupId> -->
<artifactId>maven-ear-plugin</artifactId>
<version>3.0.2</version>
<executions>
<execution>
<id>package-facturaelectronicafija</id>
<phase>package</phase>
<configuration>
<workDirectory>target/facturaelectronicafija</workDirectory>
<classifier>facturaelectronicafija</classifier>
<version>8</version>
<modules>
<webModule>
<groupId>factElectronica-web</groupId>
<artifactId>FacturaElectronica</artifactId>
<classifier>facturaelectronicafija</classifier>
<contextRoot>/FacturaElectronica</contextRoot>
<bundleFileName>/FacturaElectronica.war</bundleFileName>
</webModule>
</modules>
</configuration>
<goals>
<goal>ear</goal>
</goals>
</execution>
<execution>
<id>package-facturaelectronicamovil</id>
<phase>package</phase>
<configuration>
<workDirectory>target/facturaelectronicamovil</workDirectory>
<classifier>facturaelectronicamovil</classifier>
<version>8</version>
<modules>
<webModule>
<groupId>factElectronica-web</groupId>
<artifactId>FacturaElectronica</artifactId>
<classifier>facturaelectronicamovil</classifier>
<contextRoot>/FacturaElectronica</contextRoot>
<bundleFileName>/FacturaElectronica.war</bundleFileName>
</webModule>
</modules>
</configuration>
<goals>
<goal>ear</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<finalName>FacturaElectronica</finalName>
</build>
</project>
Now the executions are done and maven creates three ears, the first one, which is called "FacturaElectronica" I created it to test that it actually works. The problem is that the three ears have exactly the same content as "FacturaElectronica". I think it is because maven does not find the dependence towards "facturaelectronicafija" and "facturaelectronicafija". Maybe because when I create these WARs in executions I can't add a version to them. Somebody could clarify me this please? Thank you very much!
I would create a multi-module project where each WAR and each EAR are separate modules.
The classes would be a JAR module that is used in the two WAR modules
I had to make some corrections, but I managed to leave it working as expected.
WebProject
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<executions>
<execution>
<id>default-install</id>
<phase>never</phase>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<executions>
<execution>
<id>default-war</id>
<phase>none</phase>
<configuration>
<finalName>unwanted</finalName>
<classifier>unwanted</classifier>
</configuration>
</execution>
<execution>
<id>package-facturaelectronicafija</id>
<phase>package</phase>
<configuration>
<classifier>facturaelectronicafija</classifier>
<webappDirectory>${project.build.directory}/${project.build.finalName}-facturaelectronicafija</webappDirectory>
<webResources>
<resource>
<directory>src/main/webapp</directory>
</resource>
</webResources>
</configuration>
<goals>
<goal>war</goal>
</goals>
</execution>
<execution>
<id>package-facturaelectronicamovil</id>
<phase>package</phase>
<configuration>
<classifier>facturaelectronicamovil</classifier>
<webappDirectory>${project.build.directory}/${project.build.finalName}-facturaelectronicamovil</webappDirectory>
<webResources>
<resource>
<directory>src/main/webappFant</directory>
</resource>
</webResources>
</configuration>
<goals>
<goal>war</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
<finalName>FacturaElectronica</finalName>
</build>
The default install run is there so that the default war base is not created.
EarProject
<modelVersion>4.0.0</modelVersion>
<groupId>factElectronicaWeb-ear</groupId>
<artifactId>factElectronicaWeb-ear</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>ear</packaging>
<dependencies>
<dependency>
<groupId>factElectronica-web</groupId>
<artifactId>FacturaElectronica</artifactId>
<version>1.0-SNAPSHOT</version>
<classifier>facturaelectronicafija</classifier>
<scope>compile</scope>
<type>war</type>
</dependency>
<dependency>
<groupId>factElectronica-web</groupId>
<artifactId>FacturaElectronica</artifactId>
<classifier>facturaelectronicamovil</classifier>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
<type>war</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<executions>
<execution>
<id>default-install</id>
<phase>never</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>3.0.2</version>
<executions>
<execution>
<id>default-ear</id>
<phase>none</phase>
<configuration>
<finalName>unwanted</finalName>
<classifier>unwanted</classifier>
</configuration>
</execution>
<execution>
<id>package-facturaelectronicafija</id>
<phase>package</phase>
<configuration>
<workDirectory>target/facturaelectronicafija</workDirectory>
<classifier>facturaelectronicafija</classifier>
<version>8</version>
<modules>
<webModule>
<groupId>factElectronica-web</groupId>
<artifactId>FacturaElectronica</artifactId>
<classifier>facturaelectronicafija</classifier>
<contextRoot>/FacturaElectronica</contextRoot>
<bundleFileName>/FacturaElectronica-facturaelectronicafija.war</bundleFileName>
</webModule>
<webModule>
<groupId>factElectronica-web</groupId>
<artifactId>FacturaElectronica</artifactId>
<classifier>facturaelectronicamovil</classifier>
<excluded>true</excluded>
</webModule>
</modules>
</configuration>
<goals>
<goal>ear</goal>
</goals>
</execution>
<execution>
<id>package-facturaelectronicamovil</id>
<phase>package</phase>
<configuration>
<workDirectory>target/facturaelectronicamovil</workDirectory>
<classifier>facturaelectronicamovil</classifier>
<version>8</version>
<modules>
<webModule>
<groupId>factElectronica-web</groupId>
<artifactId>FacturaElectronica</artifactId>
<classifier>facturaelectronicamovil</classifier>
<contextRoot>/DetalleFactura</contextRoot>
<bundleFileName>/FacturaElectronica-facturaelectronicamovil.war</bundleFileName>
</webModule>
<webModule>
<groupId>factElectronica-web</groupId>
<artifactId>FacturaElectronica</artifactId>
<classifier>facturaelectronicafija</classifier>
<excluded>true</excluded>
</webModule>
</modules>
</configuration>
<goals>
<goal>ear</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<finalName>FacturaElectronica</finalName>
</build>
Previously the dependencies generated only a meta inf file, this was because they were with a scope provided, when you switch to compile it works correctly.
<dependency>
<groupId>factElectronica-web</groupId>
<artifactId>FacturaElectronica</artifactId>
<classifier>facturaelectronicamovil</classifier>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
<type>war</type>
</dependency>
I'm trying to build a jar file using jdk1.3 and maven 1.0.2. This is old java code which means I can't use a newer version of java. Below is the pom file I'm currently using:
<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.sample.team</groupId>
<artifactId>Base</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>Base</name>
<url>http://maven.apache.org</url>
<properties>
<jdk.version>1.3</jdk.version>
<!--jodatime.version>2.5</jodatime.version-->
<junit.version>4.10</junit.version>
<log4j.version>1.2.16</log4j.version>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
<!--dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>1.2.16</version>
</dependency-->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
</dependency>
</dependencies>
<build>
<finalName>Base</finalName>
<resources>
<resource>
<directory>nebModule</directory>
<filtering>true</filtering>
<includes>
<include>com\abc\ebill\base\**\*.class</include>
<include>com\abc\team\common\domain\**\*.class</include>
</includes>
</resource>
</resources>
<plugins>
<!-- download source code in Eclipse, best practice -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
<configuration>
<downloadSources>true</downloadSources>
<downloadJavadocs>false</downloadJavadocs>
</configuration>
</plugin>
<!-- Set a compiler level -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
</configuration>
</plugin>
<!-- Make this jar executable -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<excludes>
<exclude>**/log4j.properties</exclude>
</excludes>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<!--mainClass>com.mkyong.core.utils.App</mainClass-->
<classpathPrefix>dependency-jars/</classpathPrefix>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
</manifest>
</archive>
<includes>
<include>**\com\abc\ebill\base\**\*.class</include>
<include>**\com\abc\team\common\domain\**\*.class</include>
</includes>
</configuration>
</plugin>
<!-- Copy project dependency -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.5.1</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<!-- exclude junit, we need runtime dependency only -->
<includeScope>runtime</includeScope>
<outputDirectory>${project.build.directory}/dependency-jars/</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
<executions>
<execution>
<id>copy-resources</id>
<!-- here the phase you need -->
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target/extra-resources</outputDirectory>
<resources>
<resource>
<directory>nebModule</directory>
<filtering>true</filtering>
<includes>
<include>com\abc\ebill\base\**\*.java</include>
<include>com\abc\team\common\domain\**\*.java</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
When calling: maven -X -p pom.xml jar:jar, a target workspace is created with a jar called Base and three folders: classes, test-classes, test-reports. The folders and the jar are empty. How can I compile the .java files into classes in: com\abc\ebill\base***.java and com\abc\team\common\domain***.java and add them to the jar?
I am new to GWT. I tried to make a web application and uses the following maven config to config gwt. I put it in a profile so only when the profile is invoked will the gwt being compiled.
The profile is like:
<profiles>
<profile>
<id>gwtCompile</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>2.5.0</version>
<configuration>
<extraJvmArgs>-Xmx512M -Xss1024k </extraJvmArgs>
<module>com.mycompany.MyMainModule</module>
<inplace>true</inplace>
<force>true</force>
<disableCastChecking>true</disableCastChecking>
<style>PRETTY</style>
<warSourceDirectory>${basedir}/war</warSourceDirectory>
</configuration>
<dependencies>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwt.version}</version>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
<version>${gwt.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>compileJS</id>
<phase>process-classes</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
When I run the command:
mvn clean install -Dmaven.test.skip=true -PgwtCompile
it gave me error message:
GWT Module com.mycompany.MyMainModule not found in project sources or resources.
My MyMainModule.gwt.xml is like this:
<?xml version="1.0" encoding="UTF-8"?>
<module>
<inherits name='com.google.gwt.user.User' />
<entry-point class='com.mycompany.MyMainModule' />
<source path='client' />
<source path='shared' />
</module>
I can see some online documents said multiple module project is supposed to have this error. But mime is not a multi-module project.
Can someone let me know what possibly went wrong with this?
Many thanks.
EDIT:
I have got this in place:
<resources>
<resource>
<directory>${basedir}/src/main/java</directory>
<includes>
<include>**/client/**</include>
<include>**/*.gwt.xml</include>
</includes>
</resource>
<resource>
<directory>${basedir}/src/main/resources</directory>
<includes>
<include>**/*</include>
</includes>
</resource>
</resources>
Try adding resources tag in your build tag.
<build>
<resources>
<resource>
<directory>${basedir}/src/main/java</directory>
</resource>
<resource>
<directory>${basedir}/src/main/resources</directory>
</resource>
</resources>
<!-- **Other build tags** -->
</build>
I found the solution to this. The problem was that the module specified in the gwt-maven-plugin has to be the exact path name of the .gwt.xml file, not the entry point file.
So the configuration file has to be:
<configuration>
<extraJvmArgs>-Xmx512M -Xss1024k </extraJvmArgs>
<module>com.mycompany.myoroject.MyMainModule</module>
<inplace>true</inplace>
<force>true</force>
<disableCastChecking>true</disableCastChecking>
<style>PRETTY</style>
<warSourceDirectory>${basedir}/war</warSourceDirectory>
</configuration>
becasue my MyMainModule.gwt.xml is under src/main/com/mycompany/myproject/MyMainModule.gwt.xml.
Many thanks for your answers.
Important config vars are outputDirectory and webappDirectory. See here:
<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.gwt</groupId>
<artifactId>gwt-ui-sandbox</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>GWT UI Sandbox</name>
<properties>
<license.licenseName>apache_v2</license.licenseName>
<license.inceptionYear>2012</license.inceptionYear>
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
<default.encoding>UTF-8</default.encoding>
<project.build.sourceEncoding>${default.encoding}</project.build.sourceEncoding>
<project.reporting.outputEncoding>${default.encoding}</project.reporting.outputEncoding>
<maven.compiler.plugin.encoding>${default.encoding}</maven.compiler.plugin.encoding>
<gwt.version>2.5.0</gwt.version>
</properties>
<dependencies>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
</dependencies>
<build>
<outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<excludes>
<exclude>**/*.css</exclude>
<exclude>**/Messages.properties</exclude>
</excludes>
</resource>
</resources>
<plugins>
<!-- <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<id>first</id>
<goals>
<goal>update-file-header</goal>
</goals>
<phase>process-sources</phase>
</execution>
</executions>
</plugin>-->
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
</plugin>
<!-- Copy static web files before executing gwt:run -->
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>exploded</goal>
</goals>
</execution>
</executions>
<configuration>
<webappDirectory>${webappDirectory}</webappDirectory>
</configuration>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>2.1.2</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.8.1</version>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>8.1.9.v20130131</version>
<executions>
<execution>
<id>start-jetty</id>
<phase>pre-integration-test</phase>
<goals>
<goal>deploy-war</goal>
</goals>
<configuration>
<daemon>true</daemon>
<scanIntervalSeconds>0</scanIntervalSeconds>
</configuration>
</execution>
<execution>
<id>stop-jetty</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
<configuration>
<systemProperties>
<systemProperty>
<name>some.prop</name>
<value>false</value>
</systemProperty>
</systemProperties>
<stopKey>stop</stopKey>
<stopPort>8079</stopPort>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>${gwt.version}</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>css</goal>
<goal>i18n</goal>
<goal>generateAsync</goal>
<!-- package source files with .class files: -->
<!-- (this is not good for dev mode incremental parsing) -->
<!-- <goal>resources</goal> -->
</goals>
</execution>
</executions>
<configuration>
<runTarget>index.html</runTarget>
<hostedWebapp>${webappDirectory}</hostedWebapp>
<compileReport>false</compileReport>
<style>PRETTY</style>
<draftCompile>true</draftCompile>
<logLevel>INFO</logLevel>
<mode>manual</mode>
<productionMode>true</productionMode>
<remoteweb>rmi://127.0.0.1/chromium</remoteweb>
<browser>/usr/bin/chromium-browser</browser>
<timeOut>${gwt.timeout}</timeOut>
<i18nMessagesBundles>
<!-- need to compile only one language in order to make the compiler happy... -->
<!-- My guess: GWT seems to directly use the properties files when using translations from sub-modules -->
<i18nMessagesBundle>com.gwt.uisandbox.Messages</i18nMessagesBundle>
</i18nMessagesBundles>
<cssFiles>
<cssFile>com/gwt/uisandbox/Style.css</cssFile>
</cssFiles>
</configuration>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<phase>process-resources</phase>
<configuration>
<target>
<!-- http://code.google.com/p/google-web-toolkit/issues/detail?id=4599 -->
<replace dir="${basedir}">
<include name="target/generated-sources/gwt/com/gwt/uisandbox/Style.java"/>
<replacetoken>interface Style extends CssResource {</replacetoken>
<replacevalue>public interface Style extends CssResource {</replacevalue>
</replace>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- http://maven.apache.org/plugins/maven-enforcer-plugin/plugin-info.html -->
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<id>enforce-sane-versions</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requirePluginVersions />
<DependencyConvergence />
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>2.1.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.7</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.4</version>
</plugin>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.2</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
</plugin>
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.2</version>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.13</version>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.7</version>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwt.version}</version>
<!-- netbeans needs provided scope to find gwt sources (when debuggung) -->
<scope>provided</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.6</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>
(See here)
BTW: you should only put java files into the end result (like the other response suggests) when building a module that gets included in another, final, compiled UI module. Otherwise, it breaks the incremental java-parsing mechanism of gwt:run.