How to add the plugin with my RCP application in the Tycho SWTBot test runtime - eclipse

My RCP was created on a 3.x Eclipse and is now on 4.x using the compatibility layer.
This is the setup that I have: I have two plugins: xyz-plugin and xyz-rcp-plugin. My RCP application is composed of these two plugins. I have a Test fragment (xyz-test) whose host plugin is xyz-plugin and contains SWTBot tests. My product configuration points to the application defined in the plugin.xml of xyz-rcp-plugin.
When I run the SWTBot Test via Eclipse, it all works ok. I point it to the correct application on the Main tab and it launches the correct one.
When I try to run it via Maven (using mvn integration-test), after the command to launch the UI for testing, no UI opens and it just reports saying there are test failures but it never actually even reaches the stage for testing my cases.
I feel this is happening because my test fragment only has xyz-plugin as its host and so knows its dependency but the application is actually contained in xyz-rcp-plugin so I am guessing it doesn't bring that plugin into the testing workspace. In fact, the test runs when I omit the <application> configuration in my pom file; it simple launches the default which is the Eclipse SDK.
So but how can I make the SWTBot test run my application, if the plugin with the application is not a dependency of the test plugin?
Below is my pom file for the test fragment,
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.xyz</groupId>
<artifactId>all</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>com.xyz.test</artifactId>
<packaging>eclipse-test-plugin</packaging>
<properties>
<ui.test.vmargs></ui.test.vmargs>
</properties>
<profiles>
<profile>
<id>macosx</id>
<activation>
<os>
<family>mac</family>
</os>
</activation>
<properties>
<ui.test.vmargs>-XstartOnFirstThread</ui.test.vmargs>
</properties>
</profile>
</profiles>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<version>${tycho-version}</version>
<configuration>
<useUIHarness>true</useUIHarness>
<useUIThread>false</useUIThread>
<product>com.xyz.rcp.product</product>
<application>com.xyz.rcp.Application</application>
<argLine>${ui.test.vmargs}</argLine>
<dependencies>
<dependency>
<!-- explicit dependency is only needed because SWTbot brings its
own hamcrest bundle which conflicts with the one from junit in the eclipse
platform -->
<type>p2-installable-unit</type>
<artifactId>org.hamcrest</artifactId>
<version>0.0.0</version>
</dependency>
</dependencies>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-xyz</id>
<phase>compile</phase>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<excludeTransitive>true</excludeTransitive>
<includeTypes>tar.gz</includeTypes>
<outputDirectory>${project.build.directory}/work</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

Tycho does not automatically add the bundle defining the configured <application> to the test runtime - you need to manually ensure that this bundle is included.
One way to do this is to specify extra dependencies in the pom.xml of the test project. In this way, you can add bundles or even entire features (as always, including transitive dependencies) to the test runtime.
Example pom.xml snippet:
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho-version}</version>
<configuration>
<dependency-resolution>
<extraRequirements>
<requirement>
<type>eclipse-plugin</type>
<id>xyz-rcp-plugin</id>
<versionRange>0.0.0</versionRange>
</requirement>
</extraRequirements>
</dependency-resolution>
</configuration>
</plugin>

Related

.jar missing in deployed JBoss .war

I know this has been asked a few times in the past, but I'm unable to find a solution (except for the "add the .jar to your project manually in Eclipse"..)
What I have:
A Maven project
A .jar web-service we've created (let's call it kc.ourwebservice)
After a clean install (in Eclipse or via the command line) and Full Publish in Eclipse (and yes, I have done an Update Maven Project - Force Update of Snapshots/Releases before that), this .jar can be found in:
This kc.ourwebservice.jar is present in our Nexus Repository Manager OSS
This kc.ourwebservice.jar is present in our Eclipse project at the Maven dependencies
This kc.ourwebservice.jar is present when I run mvn dependency:tree -Dverbose
This kc.ourwebservice.jar is present in my .m2 folder
However, it's missing from the deployed JBoss .war's lib folder, which is what my question is about.
I know I could manually add the .jar in Eclipse' Deployment Assembly (or org.eclipse.wst.common.component file), but every time I switch git branches or do an "Update Maven Project", it's gone again. And I also don't want to manually add this .jar when the project is put on a server.
I need a permanent solution so the .jar is correctly added to the deployed JBoss .war, using the Maven plugins that were designed for it.
One thing to add. This webservice has both an .aar and .jar. Both of them are necessary. The .jar when we're starting the application, so I gave it a <scope>compile</scope>, and all the .aar we use are only needed at runtime, so I gave it that scope (<scope>runtime</scope>).
Here is the relevant pom.xml code (lots of more dependencies, plugins and code at the ...'s, but those are irrelevant for this problem):
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
...
</parent>
<artifactId>...</artifactId>
<packaging>war</packaging>
...
<properties>
...
<ourwebservice.version>1.0.0</ourwebservice.version>
...
</properties>
...
<plugins>
...
<!-- Takes care of copying the aar services to the WEB-INF/services -->
<plugin>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-repo-maven-plugin</artifactId>
<version>1.7.3</version>
<configuration>
<outputDirectory>${project.build.directory}/generated-resources</outputDirectory>
<stripServiceVersion>false</stripServiceVersion>
<services>...,ourwebservice</services>
</configuration>
<executions>
<execution>
<phase>generate-resources</phase>
<id>deploy webservices</id>
<goals>
<goal>create-repository</goal>
</goals>
</execution>
</executions>
</plugin>
...
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>${maven.war.plugin.version}</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
<outputDirectory>${warOutputDir}</outputDirectory>
<webappDirectory>${webappDirectory}</webappDirectory>
<warName>${project.artifactId}</warName>
<!-- Tell the maven war plugin to use the merged web.xml -->
<webXml>${warOutputDir}/web.xml</webXml>
<warSourceExcludes>.gwt-tmp/**</warSourceExcludes>
<webResources>
<resource>
<directory>${basedir}/src</directory>
<targetPath>WEB-INF/classes</targetPath>
<excludes>
<exclude>**/*.java</exclude>
<exclude>sample-properties.properties</exclude>
<exclude>sample-log4j.properties</exclude>
</excludes>
</resource>
<!-- Copy the generated services that were extracted from the dependencies to the WEB-INF/services folder of the war archive. -->
<resource>
<directory>${project.build.directory}/generated-resources/services</directory>
<targetPath>/WEB-INF/services</targetPath>
<includes>
<include>**/*.aar</include>
</includes>
</resource>
...
</webResources>
<!-- The axis2 services should not be stored in the WEB-INF/lib -->
<packagingExcludes>WEB-INF/lib/*.aar</packagingExcludes>
</configuration>
</plugin>
<!-- JBoss plugin used to deploy war file - http://mojo.codehaus.org/jboss-maven-plugin/ -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jboss-maven-plugin</artifactId>
<version>1.1</version>
<configuration>
<hostName>${deploymentHostName}</hostName>
<port>${deploymentPort}</port>
<fileName>${deploymentFileName}</fileName>
<serverName>default</serverName>
<jbossHome>
//${deploymentHostName}/${jbossHome}
</jbossHome>
</configuration>
</plugin>
</plugins>
...
<dependencies>
...
<dependency>
<groupId>kc</groupId>
<artifactId>ourwebservice</artifactId>
<version>${ourwebservice.version}</version>
<type>aar</type>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>kc</groupId>
<artifactId>ourwebservice</artifactId>
<version>${ourwebservice.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
...
</dependencies>
...
</project>
Does anyone has any idea why the .jar isn't deployed to the .war? Or better yet, does anyone know a solution so the .jar is always deployed to this .war when doing a clean install and publish?
All other .jar files are present in the .war, this webservice is the only one missing.

How to correctly manage feature configuration deployment in JBoss Fuse 6.2.1?

I am trying to evaluate JBoss Fuse as an integration platform, and I have the following question regarding deployment.
I am trying to set up a fabric and use profiles, more specifically feature repositories for camel/blueprint component deployment.
I am having the following issue with externalizing the component configuration: when i update the snapshot of the configuration file artifact, the configuration changes are not picked up by the container.
Moreover, when i completely remove the profile from the container, the PID config file stays on the server in etc/ folder.
Also there is an additional issue during deployment where the camel bundle gets activated before the config pid file is loaded, resulting in exception in aries blueprint, and i have to additionally refresh the osgi bundle manually.
Here is how the feature repository file looks like:
<?xml version="1.0" encoding="UTF-8"?>
<features name="fuse-poc">
<feature name="fuse-poc-common" version="${project.version}">
<bundle>mvn:com.myorg.fuse/common/${project.version}</bundle>
</feature>
<feature name="fuse-poc-camel" version="${project.version}">
<feature>fuse-poc-common</feature>
<config name="com.myorg.fuse.poc.camel">
test.value=ENC(5XdDgfKwwhMTmbo1z874eQ==)
</config>
<bundle>mvn:com.myorg.fuse/fuse-poc-camel/${project.version} </bundle>
</feature>
<feature name="fuse-poc-activemq" version="${project.version}">
<feature>fuse-poc-common</feature>
<configfile finalname="etc/com.myorg.fuse.poc.jms.cfg">
mvn:com.myorg.fuse/feature/${project.version}/cfg/dev
</configfile>
<bundle>mvn:com.myorg.fuse/fuse-poc-camel- activemq/${project.version}</bundle>
</feature>
</features>
The projects themselves are simple camel archetype projects with one having a basic route with logging and one with route using activemq and cm:property-placeholder in blueprint.xml
Here is the corresponding build section in maven:
<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.myorg.fuse</groupId>
<artifactId>fuse-poc-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>feature</artifactId>
<packaging>pom</packaging>
<name>FUSE PoC Feature Repository</name>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>filter</id>
<phase>generate-resources</phase>
<goals>
<goal>resources</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.10</version>
<executions>
<execution>
<id>attach-artifacts</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>target/classes/fuse-poc.xml</file>
<type>xml</type>
<classifier>features</classifier>
</artifact>
<artifact>
<file>src/main/resources/env/dev/com.myorg.fuse.poc.jms.cfg</file>
<type>cfg</type>
<classifier>dev</classifier>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Here are the commands I use to deploy the feature:
fabric:version-create 1.1
fabric:profile-create --parent jboss-fuse-full fuse-poc
fabric:profile-edit --repository mvn:com.myorg.fuse/feature/1.0.0-SNAPSHOT/xml/features fuse-poc 1.1
fabric:profile-edit --feature fuse-poc-camel fuse-poc 1.1
fabric:profile-edit --feature fuse-poc-activemq fuse-poc 1.1
fabric:container-upgrade 1.1 root
fabric:container-add-profile root fuse-poc
After I manually do osgi:refresh <bundle id> the bundle it starts fine.
fabric:container-remove-profile root fuse-poc
All the config pid entries stay in the config, and all osgi bundles are also staying installed. How do i correctly undeploy artifacts so that the container is clean and an updated version of the same artifact can be deployed without side effects?
I suspect i am doing something conceptually wrong, because ultimately the issue above leads to the following problem: if i add a property to either the element in features, or the .cfg file and install the project using maven again, and then do container-remove-profile, profile-refresh, and container-add-profile, the config does not change at all. It can only be redeployed correctly if i manually do the config:delete command on my pid in the console.
So I finally had time to dig through the sources and cross-reference karaf, fabric and jboss documentation.
Here is how it works:
The code responsible for loading/unloading bundles through the feature repository system is located in fabric-agent-1.2.0.redhat-621084.jar
Notably, the class io.fabric8.agent.service.FeatureConfigInstaller is responsible for the configuration entries, and the class io.fabric8.agent.service.Agent is doing the overall deployment
There is no code at all to uninstall the config file/remove config entries. This makes it troublesome to do development with SNAPSHOTs
However, there is a useful 'override' property that can be specified on the <configfile> element - if it is set to true, the config PID file will be overwritten on deployment which is exactly what i wanted for local development
For <config> element, there is an undocumented 'append' property, which, when set to true, is supposed to append new entries to the config. However, it is hilariously bugged - turns out it also removes all defined previously existing properties when trying to append. Conclusion - use <configfile> functionality instead
Additionally, for externalizing environment configuration i've come to the conclusion the most simple way is to produce multiple feature xml descriptors from the same file through different maven build profiles. The project files consequently look like this:
pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.myorg.fuse</groupId>
<artifactId>fuse-poc-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>feature</artifactId>
<packaging>pom</packaging>
<name>FUSE PoC Feature Repository</name>
<properties>
<build.environment>dev</build.environment>
</properties>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>filter</id>
<phase>generate-resources</phase>
<goals>
<goal>resources</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.10</version>
<executions>
<execution>
<id>attach-artifacts</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>target/classes/fuse-poc.xml</file>
<type>xml</type>
<classifier>features-${build.environment}</classifier>
</artifact>
<artifact>
<file>src/main/resources/env/${build.environment}/com.myorg.fuse.poc.cfg</file>
<type>cfg</type>
<classifier>${build.environment}</classifier>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>local</id>
<properties>
<build.environment>local-dev</build.environment>
</properties>
</profile>
<profile>
<id>dev</id>
<properties>
<build.environment>dev</build.environment>
</properties>
</profile>
<profile>
<id>uat</id>
<properties>
<build.environment>uat</build.environment>
</properties>
</profile>
<profile>
<id>prod</id>
<properties>
<build.environment>prod</build.environment>
</properties>
</profile>
</profiles>
</project>
feature.xml:
<?xml version="1.0" encoding="UTF-8"?>
<features name="fuse-poc">
<feature name="fuse-poc-common" version="${project.version}">
<bundle>mvn:com.myorg.fuse/common/${project.version}</bundle>
</feature>
<feature name="fuse-poc-camel" version="${project.version}">
<feature>fuse-poc-common</feature>
<configfile finalname="etc/com.myorg.fuse.poc.cfg" override="true">
mvn:com.myorg.fuse/feature/${project.version}/cfg/${build.environment}
</configfile>
<bundle>mvn:com.myorg.fuse/fuse-poc-camel/${project.version}</bundle>
</feature>
</features>
This way you can directly specify the environment when creating the profile for deploying the feature:
fabric:profile-create --parent jboss-fuse-full fuse-poc fabric:profile-edit --repository mvn:com.myorg.fuse/feature/1.0.0-SNAPSHOT/xml/features-local-dev fuse-poc
Note to set up the build integration tool to build the feature module for all profiles except 'local-dev', since that one needs to be used by developers locally and should not be downloaded from the central repository
On a final note, once i resolved the config handling issues and the bundles started deploying correctly, the platform also started undeploying bundles correctly on removing the profile from the container. I suspect there is some issue with uninstalling the bundles whenever the original deployment ended in failure

Cannot add maven dependencies to deployment assembly in ejb packaging

I have a project with a POM that looks like 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>
<parent>
<artifactId>my-parent</artifactId>
<groupId>com.company</groupId>
<version>2</version>
</parent>
<groupId>com.company</groupId>
<artifactId>resources-silo</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>ejb</packaging>
<name>Some EJB component</name>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ejb-plugin</artifactId>
<configuration>
<ejbVersion>3.0</ejbVersion>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>simple-command</id>
<phase>package</phase>
<goals>
<goal>attached</goal>
</goals>
<inherited>false</inherited>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<!-- some jars ... -->
</dependencies>
</project>
I want to use m2eclipse with m2e-wtp to deploy this project to Glassfish 3. However, m2e-wtp does not deploy the dependencies. I know that building superjars with jar-with-dependencies is probably not the way to go for EJB projects, but I cannot really change this without messing up the customer's build / deployment processes.
So, the problem is that the deployment assembly wizard does not display the maven dependencies:
I need a solution that works without changing the pom.xml, since that would disturb the customer's build processes. I am aware that using an EAR would be the preferred solution here.
Is the behaviour that I'm seeing a bug or is it an inherent limitation in the way m2e-wtp and the ejb packaging work?
Is it even possible to have m2e-wtp extract dependency jars into the deployed application?

In IntelliJ Scala plugin, can I use scala-compiler.jar retrieved via <dependency> in `pom.xml`?

In IntelliJ, I created a blank Maven project, and added to pom.xml:
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-compiler</artifactId>
<version>2.11.0-M3</version>
<scope>compile</scope>
</dependency>
I then went to Project Settings -> Modules -> + -> Scala, and specified the compiler jar from the drop-down menu as Maven: org.scala-lang:scala-compiler:2.11.0-M3. I receive the error:
Compiler library: no scala-library*.jar found
Of course, scala-library-2.11.0-M3.jar is among the dependencies (transitively), but not stored in the same folder as scala-compiler-2.11.0-M3.jar, which is what seems to be confusing the Scala plugin.
Is there any way to use scala-compiler*.jar downloaded from a pom.xml dependency? Perhaps by manually specifying where to find each JAR?
Before this, I had been using scala-compiler*.jar downloaded via Project Settings -> Libraries -> + -> From Maven. This seems to work because IntelliJ sticks all the downloaded JARs in the same folder, which is what the Scala plugin assumes. Simply for aesthetic reasons I would like to know if it can be done with pom.xml.
You don't need the scala-compiler as a dependency to be able to build the scala project (neither using maven at command line nor by building from Build | Make Project in IntelliJ).
This is a very simple pom.xml that I use for scala projects where I don't have scala installed at all and just point IntelliJ to this pom and then I can compile and run any scala code directly from within IntelliJ.
<?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.stackoverflow</groupId>
<artifactId>scala-app</artifactId>
<version>1.0-SNAPSHOT</version>
<name>${project.artifactId}-${project.version}</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<scala.version>2.10.1</scala.version>
</properties>
<dependencies>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>${scala.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<version>2.15.2</version>
<executions>
<execution>
<id>scala-compile</id>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
<configuration>
<args>
<arg>-make:transitive</arg>
<arg>-dependencyfile</arg>
<arg>${project.build.directory}/.scala_dependencies</arg>
</args>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

Create a GWT Maven Project

I'm trying to create a new project with Eclipse in order to create GWT application under maven 2 system.
I have create the project with the follow mvn command
mvn archetype:generate -DarchetypeRepository=repo1.maven.org -DarchetypeGroupId=org.codehaus.mojo -DarchetypeArtifactId=gwt-maven-plugin -DarchetypeVersion=2.3.0
I have installed the follow eclipse plugins:
* m2eclipse
* egit
* gwt plugin
Here my POM file:
<?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">
<!-- POM file generated with GWT webAppCreator -->
<modelVersion>4.0.0</modelVersion>
<groupId>com.mobc3.paperquid</groupId>
<artifactId>Backoffice</artifactId>
<packaging>war</packaging>
<version>1.0.0-SNAPSHOT</version>
<name>GWT Maven Archetype</name>
<properties>
<!-- Convenience property to set the GWT version -->
<gwtVersion>2.3.0</gwtVersion>
<!-- GWT needs at least java 1.5 -->
<maven.compiler.source>1.5</maven.compiler.source>
<maven.compiler.target>1.5</maven.compiler.target>
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
</properties>
<dependencies>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>2.3.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>2.3.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<!-- Generate compiled stuff in the folder used for developing mode -->
<outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>
<plugins>
<!-- GWT Maven Plugin -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>2.3.0</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test</goal>
<goal>i18n</goal>
<goal>generateAsync</goal>
</goals>
</execution>
</executions>
<!-- Plugin configuration. There are many available options, see gwt-maven-plugin
documentation at codehaus.org -->
<configuration>
<runTarget>Backoffice.html</runTarget>
<hostedWebapp>${webappDirectory}</hostedWebapp>
<i18nMessagesBundle>com.mobc3.paperquid.backoffice.client.Messages</i18nMessagesBundle>
</configuration>
</plugin>
<!-- Copy static web files before executing gwt:run -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>exploded</goal>
</goals>
</execution>
</executions>
<configuration>
<webappDirectory>${webappDirectory}</webappDirectory>
</configuration>
</plugin>
</plugins>
</build>
</project>
I can compile and deploy my application using the linux shell but I have many problems to build and run the application inside eclipse.
I haven't found any tutorial that explain how to create step by step a GWT application under maven inside eclipse.
Can someone help me?
One more option:
Make a gwt project by using the gwt plugin in Eclipse. Now you have an Eclipse gwt project.
Select the project in Project Explorer, right-click it, then choose Configure. Then select Convert to Maven Project. Now you get a gwt-maven project.
Now add necessary dependencies to pom.xml.
Here is the relevant (I think) section from my pom setup when I was running my GWT app with the gwt:run goal:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>2.3.0</version>
<configuration>
<runTarget>/ModuleName.html</runTarget>
<modules>
<module>${project.groupId}.package.ModuleName</module>
</modules>
<copyWebapp>true</copyWebapp>
</configuration>
<executions>
<execution>
<configuration>
<extraParam>true</extraParam>
</configuration>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
I should say, though, that I now use the GWT Eclipse Plugin to run my app within Eclipse, so it's been a while since I used this configuration. From what I remember reading, the "copyWebapp" "true" is one of the key pieces of configuration. It also helped me to specify the module name directly, because the gwt-maven-plugin sometimes had problems locating it.