Return to Snippet

Revision: 13582
at May 3, 2009 08:38 by salvadordiaz


Updated Code
<?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>fr.salvadordiaz.gwt.sample</groupId>
	<artifactId>maven-example</artifactId>
	<packaging>war</packaging>
	<version>1.0-SNAPSHOT</version>
	<name>gwt-maven-archetype-project</name>
	<properties>
		<!-- convenience to define GWT version in one place -->
		<gwt.version>1.6.4</gwt.version>
		<!--  tell the compiler we can use 1.5 -->
		<maven.compiler.source>1.5</maven.compiler.source>
		<maven.compiler.target>1.5</maven.compiler.target>
		<!-- define a transient output directory for gwt -->
		<gwt.output.directory>${basedir}/target/gwt</gwt.output.directory>
		<!-- the value of the rename-to attribute in your GWT module configuration -->
		<gwt.module.alias>Application</gwt.module.alias>
	</properties>
	<dependencies>
		<!--  GWT dependencies (from central repo) -->
		<dependency>
			<groupId>com.google.gwt</groupId>
			<artifactId>gwt-servlet</artifactId>
			<version>${gwt.version}</version>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>com.google.gwt</groupId>
			<artifactId>gwt-user</artifactId>
			<version>${gwt.version}</version>
			<scope>provided</scope>
		</dependency>

	    <!-- test -->
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.4</version>
			<scope>test</scope>
		</dependency>
	</dependencies>
	<build>
		<!-- Compile classes into the war transient directory for hosted mode live editing -->
		<outputDirectory>${gwt.output.directory}/WEB-INF/classes</outputDirectory>

		<plugins>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>gwt-maven-plugin</artifactId>
				<version>1.1-SNAPSHOT</version>
				<executions>
					<execution>
						<phase>process-classes</phase>
						<configuration>
							<output>${gwt.output.directory}</output>
							<logLevel>INFO</logLevel>
						</configuration>
						<goals>
							<goal>compile</goal>
						</goals>
					</execution>
				</executions>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>2.0.2</version>
				<configuration>
					<source>${maven.compiler.source}</source>
					<target>${maven.compiler.target}</target>
					<encoding>UTF-8</encoding>
		            <!-- Fix for GWT issue #3439 -->
					<excludes>
						<exclude>javax/servlet/**</exclude>
					</excludes>
				</configuration>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-resources-plugin</artifactId>
				<version>2.3</version>
				<!-- set encoding to something not platform dependent -->
				<configuration>
					<encoding>UTF-8</encoding>
				</configuration>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-antrun-plugin</artifactId>
				<version>1.2</version>
				<executions>
					<!-- This execution copies the war folder to the gwt transient output directory -->
					<execution>
						<id>war-folder-creation</id>
						<phase>process-resources</phase>
						<goals>
							<goal>run</goal>
						</goals>
						<configuration>
							<tasks>
								<copy todir="${gwt.output.directory}">
									<fileset dir="${basedir}/src/main/webapp" />
								</copy>
							</tasks>
						</configuration>
					</execution>
				</executions>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-war-plugin</artifactId>
				<!-- Include GWT compiler output in the war -->
				<configuration>
					<webResources>
						<resource>
		              		<!-- this is relative to the pom.xml directory, it's the GWT compiler output -->
							<directory>${gwt.output.directory}/${gwt.module.alias}</directory>
							<!-- override the destination directory (WEB-INF/classes) for this resource -->
							<targetPath>${gwt.module.alias}</targetPath>
						</resource>
					</webResources>
				</configuration>
			</plugin>
		</plugins>
	</build>

	<!-- This should really be located in your settings.xml but for simplicity's sake we will leave it here -->
	<pluginRepositories>
		<pluginRepository>
			<id>Codehaus Mojo Snapshot</id>
			<url>http://snapshots.repository.codehaus.org/</url>
		</pluginRepository>
	</pluginRepositories>
</project>

Revision: 13581
at April 30, 2009 15:47 by salvadordiaz


Updated Code
<?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>fr.salvadordiaz.gwt.sample</groupId>
	<artifactId>maven-example</artifactId>
	<packaging>war</packaging>
	<version>1.0-SNAPSHOT</version>
	<name>gwt-maven-archetype-project</name>

	<properties>
		<!-- convenience to define GWT version in one place -->
		<gwt.version>1.6.4</gwt.version>
		<!--  tell the compiler we can use 1.5 -->
		<maven.compiler.source>1.5</maven.compiler.source>
		<maven.compiler.target>1.5</maven.compiler.target>
		<!-- define a transient output directory for gwt -->
		<gwt.output.directory>${project.build.directory}/gwt</gwt.output.directory>
		<!-- the value of the rename-to attribute in your GWT module configuration -->
		<gwt.module.alias>Application</gwt.module.alias>
	</properties>

	<dependencies>
		<!--  GWT dependencies (from central repo) -->
		<dependency>
			<groupId>com.google.gwt</groupId>
			<artifactId>gwt-servlet</artifactId>
			<version>${gwt.version}</version>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>com.google.gwt</groupId>
			<artifactId>gwt-user</artifactId>
			<version>${gwt.version}</version>
			<scope>provided</scope>
		</dependency>

	    <!-- test -->
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.4</version>
			<scope>test</scope>
		</dependency>
	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>gwt-maven-plugin</artifactId>
				<version>1.1-SNAPSHOT</version>
				<executions>
					<execution>
						<phase>process-classes</phase>
						<configuration>
							<output>${gwt.output.directory}</output>
							<logLevel>INFO</logLevel>						
						</configuration>
						<goals>
							<goal>compile</goal>
						</goals>
					</execution>
				</executions>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>2.0.2</version>
				<configuration>
					<source>${maven.compiler.source}</source>
					<target>${maven.compiler.target}</target>
					<encoding>UTF-8</encoding>
		            <!-- Fix for GWT issue #3439 -->
					<excludes>
						<exclude>javax/servlet/**</exclude>
					</excludes>
				</configuration>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-resources-plugin</artifactId>
				<version>2.3</version>
				<!-- set encoding to something not platform dependent -->
				<configuration>
					<encoding>UTF-8</encoding>
				</configuration>
				<executions>
					<execution>
					<!-- This execution copies the war folder to the gwt transient output directory -->
						<id>war-folder-creation</id>
						<phase>process-resources</phase>
						<goals>
							<goal>copy-resources</goal>
						</goals>
						<configuration>
							<outputDirectory>${gwt.output.directory}</outputDirectory>
							<resources>
								<resource>
									<directory>src/main/webapp</directory>
									<!-- I don't filter my resources but you're free to do it -->
									<filtering>false</filtering>
								</resource>
							</resources>
						</configuration>
					</execution>
					<execution>
					<!-- This execution copies the compiler plugin output and resources to the gwt transient output directory -->
						<id>war-classes-copy</id>
						<phase>compile</phase>
						<goals>
							<goal>copy-resources</goal>
						</goals>
						<configuration>
							<outputDirectory>${gwt.output.directory}/WEB-INF/classes</outputDirectory>
							<resources>
								<resource>
									<directory>src/main/resources</directory>
									<filtering>false</filtering>
								</resource>
								<resource>
									<directory>${project.build.outputDirectory}</directory>
									<filtering>false</filtering>
								</resource>
							</resources>
						</configuration>
					</execution>
				</executions>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-war-plugin</artifactId>
				<configuration>
					<webResources>
						<resource>
		              		<!-- this is relative to the pom.xml directory -->
							<directory>${gwt.output.directory}/${gwt.module.alias}</directory>
							<!-- override the destination directory for this resource -->
							<targetPath>${gwt.module.alias}</targetPath>
						</resource>
					</webResources>
				</configuration>
			</plugin>
		</plugins>
	</build>
	<pluginRepositories>
		<pluginRepository>
			<id>Codehaus Mojo Snapshot</id>
			<url>http://snapshots.repository.codehaus.org/</url>
		</pluginRepository>
	</pluginRepositories>
</project>

Revision: 13580
at April 30, 2009 09:19 by salvadordiaz


Updated Code
<?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>fr.salvadordiaz.gwt.sample</groupId>
	<artifactId>maven-example</artifactId>
	<packaging>war</packaging>
	<version>1.0-SNAPSHOT</version>
	<name>gwt-maven-archetype-project</name>

	<properties>
		<!-- convenience to define GWT version in one place -->
		<gwt.version>1.6.4</gwt.version>
		<!--  tell the compiler we can use 1.5 -->
		<maven.compiler.source>1.5</maven.compiler.source>
		<maven.compiler.target>1.5</maven.compiler.target>
		<!-- define a transient output directory for gwt -->
		<gwt.output.directory>${project.build.directory}/gwt</gwt.output.directory>
	</properties>

	<dependencies>
		<!--  GWT dependencies (from central repo) -->
		<dependency>
			<groupId>com.google.gwt</groupId>
			<artifactId>gwt-servlet</artifactId>
			<version>${gwt.version}</version>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>com.google.gwt</groupId>
			<artifactId>gwt-user</artifactId>
			<version>${gwt.version}</version>
			<scope>provided</scope>
		</dependency>

	    <!-- test -->
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.4</version>
			<scope>test</scope>
		</dependency>
	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>gwt-maven-plugin</artifactId>
				<version>1.1-SNAPSHOT</version>
				<executions>
					<execution>
						<goals>
							<goal>compile</goal>
						</goals>
					</execution>
				</executions>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>2.0.2</version>
				<configuration>
					<source>${maven.compiler.source}</source>
					<target>${maven.compiler.target}</target>
					<encoding>UTF-8</encoding>
		            <!-- Fix for GWT issue #3439 -->
					<excludes>
						<exclude>javax/servlet/**</exclude>
					</excludes>
				</configuration>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-resources-plugin</artifactId>
				<version>2.3</version>
				<!-- set encoding to something not platform dependent -->
				<configuration>
					<encoding>UTF-8</encoding>
				</configuration>
				<executions>
					<execution>
					<!-- This execution copies the war folder to the gwt transient output directory -->
						<id>war-folder-creation</id>
						<phase>process-resources</phase>
						<goals>
							<goal>copy-resources</goal>
						</goals>
						<configuration>
							<outputDirectory>${gwt.output.directory}</outputDirectory>
							<resources>
								<resource>
									<directory>src/main/webapp</directory>
									<!-- I don't filter my resources but you're free to do it -->
									<filtering>false</filtering>
								</resource>
							</resources>
						</configuration>
					</execution>
					<execution>
					<!-- This execution copies the compiler plugin output and resources to the gwt transient output directory -->
						<id>war-classes-copy</id>
						<phase>compile</phase>
						<goals>
							<goal>copy-resources</goal>
						</goals>
						<configuration>
							<outputDirectory>${gwt.output.directory}/WEB-INF/classes</outputDirectory>
							<resources>
								<resource>
									<directory>src/main/resources</directory>
									<filtering>false</filtering>
								</resource>
								<resource>
									<directory>${project.build.outputDirectory}</directory>
									<filtering>false</filtering>
								</resource>
							</resources>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>
</project>

Revision: 13579
at April 28, 2009 12:23 by salvadordiaz


Initial Code
<?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>fr.salvadordiaz.gwt.sample</groupId>
	<artifactId>maven-example</artifactId>
	<packaging>war</packaging>
	<version>1.0-SNAPSHOT</version>
	<name>gwt-maven-archetype-project</name>

	<properties>
		<!-- convenience to define GWT version in one place -->
		<gwt.version>1.6.4</gwt.version>
		<!--  tell the compiler we can use 1.5 -->
		<maven.compiler.source>1.5</maven.compiler.source>
		<maven.compiler.target>1.5</maven.compiler.target>
		<!-- define a transient output directory for gwt -->
		<gwt.output.directory>${project.build.directory}/gwt</gwt.output.directory>
	</properties>

	<dependencies>
		<!--  GWT dependencies (from central repo) -->
		<dependency>
			<groupId>com.google.gwt</groupId>
			<artifactId>gwt-servlet</artifactId>
			<version>${gwt.version}</version>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>com.google.gwt</groupId>
			<artifactId>gwt-user</artifactId>
			<version>${gwt.version}</version>
			<scope>provided</scope>
		</dependency>

	    <!-- test -->
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.4</version>
			<scope>test</scope>
		</dependency>
	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>gwt-maven-plugin</artifactId>
				<version>1.1-SNAPSHOT</version>
				<executions>
					<execution>
						<goals>
							<goal>compile</goal>
							<goal>generateAsync</goal>
							<goal>test</goal>
						</goals>
					</execution>
				</executions>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>2.0.2</version>
				<configuration>
					<source>${maven.compiler.source}</source>
					<target>${maven.compiler.target}</target>
					<encoding>UTF-8</encoding>
		            <!-- Fix for GWT issue #3439 -->
					<excludes>
						<exclude>javax/servlet/**</exclude>
					</excludes>
				</configuration>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-resources-plugin</artifactId>
				<version>2.3</version>
				<!-- set encoding to something not platform dependent -->
				<configuration>
					<encoding>UTF-8</encoding>
				</configuration>
				<executions>
					<execution>
					<!-- This execution copies the war folder to the gwt transient output directory -->
						<id>war-folder-creation</id>
						<phase>process-resources</phase>
						<goals>
							<goal>copy-resources</goal>
						</goals>
						<configuration>
							<outputDirectory>${gwt.output.directory}</outputDirectory>
							<resources>
								<resource>
									<directory>src/main/webapp</directory>
									<!-- I don't filter my resources but you're free to do it -->
									<filtering>false</filtering>
								</resource>
							</resources>
						</configuration>
					</execution>
					<execution>
					<!-- This execution copies the compiler plugin output and resources to the gwt transient output directory -->
						<id>war-classes-copy</id>
						<phase>compile</phase>
						<goals>
							<goal>copy-resources</goal>
						</goals>
						<configuration>
							<outputDirectory>${gwt.output.directory}/WEB-INF/classes</outputDirectory>
							<resources>
								<resource>
									<directory>src/main/resources</directory>
									<filtering>false</filtering>
								</resource>
								<resource>
									<directory>${project.build.outputDirectory}</directory>
									<filtering>false</filtering>
								</resource>
							</resources>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>
</project>

Initial URL


Initial Description
This new version uses maven-antrun-plugin to create the war transient folder to workaround a bug in m2eclipse. It also sets directly the compiler output to WEB-INF/classes in the war transient folder to minimize eclipse configuration (m2eclipse takes care of it now). Thanks to Eugene Kuleshov for the tip !

Initial Title
Modified pom for GWT 1.6.4

Initial Tags


Initial Language
XML