maven selenium serenity bdd open index.html report automatically after test - java

I have been searching but haven't found an answer. Is there anyway of opening the report index.html automatically after running a test in the terminal or in intellij? Im pretty new to this stuff. Thanks for any help.
Set up
-http://www.thucydides.info/#/
-junit
-selenium
Thank you for any future help.
Here is a copy of my pom.xml
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<junit.version>4.12</junit.version>
<serenity.version>1.0.47</serenity.version>
<serenity.maven.version>1.1.29-rc.1</serenity.maven.version>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.52.0</version>
</dependency>
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>core</artifactId>
<version>${serenity.version}</version>
</dependency>
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-junit</artifactId>
<version>${serenity.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<version>1.7.18</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.18.1</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
<configuration>
<includes>
<include>**/*Test.java</include>
<include>**/When*.java</include>
</includes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
</plugin>
<plugin>
<groupId>net.serenity-bdd.maven.plugins</groupId>
<artifactId>serenity-maven-plugin</artifactId>
<version>${serenity.maven.version}</version>
<dependencies>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>3.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<executions>
<execution>
<id>serenity-reports</id>
<phase>post-integration-test</phase>
<goals>
<goal>aggregate</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<id>auto-clean</id>
<phase>initialize</phase>
<goals>
<goal>clean</goal>
</goals>
<configuration>
<filesets>
<fileset>
<directory>/target/site/serenity</directory>
</fileset>
</filesets>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.8</version>
<reportSets>
<reportSet>
<reports>
<report>index</report>
<report>summary</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>

How about adding:
#AfterClass
directly to your Runner class and adding method with:
getDriver().get("YourReportPath")

Related

Fatal error compiling: invalid flag: --release packaging RedFX-Quantum/Strange

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

JAVA how to fix error> Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default-cli) on project sic-desktop:

I´m using netbeans and not using maven. Compile is ok but when trying to run it I get this error:
Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default-cli) on project sic-desktop: Command execution failed. Process exited with an error: -1 (Exit value: -1) -> [Help 1]
Below is the 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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.techint</groupId>
<artifactId>sic-parent</artifactId>
<version>1.0</version>
</parent>
<artifactId>sic-desktop</artifactId>
<dependencies>
<dependency>
<groupId>com.techint</groupId>
<artifactId>sic-core</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>com.techint</groupId>
<artifactId>sic-ca</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>org.netbeans.external</groupId>
<artifactId>AbsoluteLayout</artifactId>
</dependency>
<dependency>
<groupId>org.jdesktop</groupId>
<artifactId>beansbinding</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.instrument</artifactId>
</dependency>
<!-- Spring Security -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
</dependency>
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
</dependency>
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports-fonts</artifactId>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
</dependency>
<dependency>
<groupId>net.sourceforge.jtds</groupId>
<artifactId>jtds</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>com.techint.comissionamento.ComissionamentoMain</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.0</version>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>prepare-package</phase>
<configuration>
<tasks>
<replace token="#buildnumber#" value="${project.version}.${buildNumber}"
dir="target/classes">
<include name="app.properties"/>
</replace>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<!--<finalName>${project.name}-${project.version}.${buildNumber}</finalName>-->
<finalName>Comissionamento</finalName>
</build>
<profiles>
<profile>
<id>dev</id>
<properties>
<maven.test.skip>true</maven.test.skip>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<copy file="${project.parent.basedir}/config/epccom/app.dev.properties"
tofile="${project.build.outputDirectory}/app.properties"/>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
<configuration>
<doCheck>false</doCheck>
<doUpdate>false</doUpdate>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<id>prod</id>
<properties>
<maven.test.skip>true</maven.test.skip>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<copy file="${project.parent.basedir}/config/epccom/app.prod.properties"
tofile="${project.build.outputDirectory}/app.properties"/>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
<configuration>
<doCheck>false</doCheck>
<doUpdate>false</doUpdate>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jasperreports-maven-plugin</artifactId>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>compile-reports</goal>
</goals>
</execution>
</executions>
<configuration>
<sourceDirectory>src/main/jaspertreports</sourceDirectory>
<outputDirectory>${project.build.outputDirectory}/reports</outputDirectory>
</configuration>
<dependencies>
<!--note this must be repeated here to pick up correct xml validation -->
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>${jasperreports.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>
</profiles>
If you are using netbeans, then stop the current run process and start it again this error raised becouse u have a running process

Maven pulls unwanted dependencies

I'm currently facing trouble with a Java project using Maven. I have a dependency in my pom pointing to version 1.4 of Apache's commons-cli like:
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
<version>1.4</version>
</dependency>
Now during runtime I get a NoSuchMethodException because apparently, an older version of this library is being loaded into the classpath which lacks a certain method.
But, no other version is referenced in my project and mvn dependency:tree (with the verbose option!) does not list any other import of commons-cli besides the 1.4 version I explicitly use.
However, when I clear the repository in .m2 and run the maven install, I see that both version 1.0 and 1.2 of the commons-cli library are being pulled. What other reasons for pulling these dependencies can Maven have if they are not a transitive dependency of any import of mine?
Edit: Here is the full effective pom.
<!-- ====================================================================== -->
<!-- -->
<!-- Generated on 2018-05-23T06:35:53 -->
<!-- -->
<!-- ====================================================================== -->
<!-- ====================================================================== -->
<!-- -->
<!-- Effective POM for project 'com.crawljax:crawljax-cli:jar:3.7-SNAPSHOT' -->
<!-- -->
<!-- ====================================================================== -->
<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.crawljax</groupId>
<artifactId>crawljax-parent-pom</artifactId>
<version>3.7-SNAPSHOT</version>
</parent>
<groupId>com.crawljax</groupId>
<artifactId>crawljax-cli</artifactId>
<version>3.7-SNAPSHOT</version>
<name>Crawljax CLI</name>
<description>The Crawljax command line interface</description>
<url>http://crawljax.com/crawljax-cli</url>
<inceptionYear>2012</inceptionYear>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<developers>
<developer>
<id>amesbah</id>
<name>Ali Mesbah</name>
<email>a.mesbah#gmail.com</email>
<url>http://www.ece.ubc.ca/~amesbah/</url>
<organization>SALTLab, UBC</organization>
<organizationUrl>http://salt.ece.ubc.ca</organizationUrl>
<timezone>-8</timezone>
</developer>
<developer>
<id>arie.van.deursen</id>
<name>Arie van Deursen</name>
<email>arie.vanDeursen#tudelft.nl</email>
<url>http://www.st.ewi.tudelft.nl/~arie/</url>
<organization>SWERL, TU Delft</organization>
<organizationUrl>http://swerl.tudelft.nl</organizationUrl>
<timezone>+1</timezone>
</developer>
<developer>
<id>alexnederlof</id>
<name>Alex Nederlof</name>
<email>alex#nederlof.com</email>
<url>http://alex.nederlof.com</url>
<organization>TU Delft</organization>
<timezone>+1</timezone>
</developer>
</developers>
<mailingLists>
<mailingList>
<name>Crawljax Mailing List</name>
<subscribe>http://groups.google.com/group/crawljax/subscribe</subscribe>
<unsubscribe>crawljax+unsubscribe#googlegroups.com</unsubscribe>
<post>crawljax#googlegroups.com</post>
<archive>http://groups.google.com/group/crawljax</archive>
</mailingList>
</mailingLists>
<scm>
<connection>scm:git:git#github.com:crawljax/crawljax.git/crawljax-cli</connection>
<developerConnection>scm:git:git#github.com:crawljax/crawljax.git/crawljax-cli</developerConnection>
<url>https://github.com/crawljax/crawljax/crawljax-cli</url>
</scm>
<issueManagement>
<system>GitHub</system>
<url>https://github.com/crawljax/crawljax/issues</url>
</issueManagement>
<ciManagement>
<system>Jenkins</system>
<url>http://jenkins.crawljax.com</url>
</ciManagement>
<distributionManagement>
<repository>
<id>sonatype-nexus-staging</id>
<name>Nexus Release Repository</name>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
<snapshotRepository>
<id>sonatype-nexus-snapshots</id>
<name>Sonatype Nexus Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
<properties>
<arguments />
<jetty.version>9.3.0.M1</jetty.version>
<logback.version>1.1.2</logback.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<metrics.version>3.0.2</metrics.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<selenium.version>3.0.0</selenium.version>
<slf4j.version>1.7.7</slf4j.version>
<sonatypeOssDistMgmtSnapshotsUrl>https://oss.sonatype.org/content/repositories/snapshots/</sonatypeOssDistMgmtSnapshotsUrl>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.0.0</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>com.crawljax</groupId>
<artifactId>crawljax-core</artifactId>
<version>3.7-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-validator</groupId>
<artifactId>commons-validator</artifactId>
<version>1.4.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.crawljax.plugins</groupId>
<artifactId>crawloverview-plugin</artifactId>
<version>3.7-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
<version>1.4</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>18.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>1.7.7</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
<version>1.7.7</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.1.2</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<artifactId>slf4j-api</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>3.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>1.10.8</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
<scope>compile</scope>
</dependency>
</dependencies>
<repositories>
<repository>
<id>sonatype-nexus-snapshots</id>
<name>Sonatype Nexus Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</repository>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>Central Repository</name>
<url>https://repo.maven.apache.org/maven2</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<releases>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>Central Repository</name>
<url>https://repo.maven.apache.org/maven2</url>
</pluginRepository>
</pluginRepositories>
<build>
<sourceDirectory>/home/roper/idp-business-logic/crawljax-mainline/crawljax/cli/src/main/java</sourceDirectory>
<scriptSourceDirectory>/home/roper/idp-business-logic/crawljax-mainline/crawljax/cli/src/main/scripts</scriptSourceDirectory>
<testSourceDirectory>/home/roper/idp-business-logic/crawljax-mainline/crawljax/cli/src/test/java</testSourceDirectory>
<outputDirectory>/home/roper/idp-business-logic/crawljax-mainline/crawljax/cli/target/classes</outputDirectory>
<testOutputDirectory>/home/roper/idp-business-logic/crawljax-mainline/crawljax/cli/target/test-classes</testOutputDirectory>
<resources>
<resource>
<filtering>true</filtering>
<directory>/home/roper/idp-business-logic/crawljax-mainline/crawljax/cli/src/main/resources</directory>
</resource>
</resources>
<testResources>
<testResource>
<directory>/home/roper/idp-business-logic/crawljax-mainline/crawljax/cli/src/test/resources</directory>
</testResource>
</testResources>
<directory>/home/roper/idp-business-logic/crawljax-mainline/crawljax/cli/target</directory>
<finalName>crawljax-cli-3.7-SNAPSHOT</finalName>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.3</version>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2-beta-5</version>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
</plugin>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.1</version>
<configuration>
<mavenExecutorId>forked-path</mavenExecutorId>
<useReleaseProfile>false</useReleaseProfile>
<arguments> -Psonatype-oss-release</arguments>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.1</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.5</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.1</version>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
</plugin>
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<version>2.1.10</version>
<executions>
<execution>
<goals>
<goal>revision</goal>
</goals>
<configuration>
<dateFormat>yyyy-MM-dd HH:mm:ss z</dateFormat>
<verbose>false</verbose>
<generateGitPropertiesFile>true</generateGitPropertiesFile>
<gitDescribe>
<always>true</always>
<abbrev>7</abbrev>
<dirty>-dirty</dirty>
</gitDescribe>
</configuration>
</execution>
</executions>
<configuration>
<dateFormat>yyyy-MM-dd HH:mm:ss z</dateFormat>
<verbose>false</verbose>
<generateGitPropertiesFile>true</generateGitPropertiesFile>
<gitDescribe>
<always>true</always>
<abbrev>7</abbrev>
<dirty>-dirty</dirty>
</gitDescribe>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<id>enforce-maven</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<version>(,2.1.0),(2.1.0,2.2.0),(2.2.0,)</version>
<message>Maven 2.1.0 and 2.2.0 produce incorrect GPG signatures and checksums respectively.</message>
</requireMavenVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>zip-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/main/resources/jar-with-dependencies.xml</descriptor>
</descriptors>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
</execution>
</executions>
<configuration>
<descriptors>
<descriptor>src/main/resources/jar-with-dependencies.xml</descriptor>
</descriptors>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
</plugin>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.5</version>
<configuration>
<goals>assembly:assembly</goals>
<tagNameFormat>crawljax-#{project.version}</tagNameFormat>
<mavenExecutorId>forked-path</mavenExecutorId>
<useReleaseProfile>false</useReleaseProfile>
<arguments> -Psonatype-oss-release</arguments>
</configuration>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<id>default-jar</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>com.crawljax.cli.JarRunner</mainClass>
</manifest>
</archive>
</configuration>
</execution>
<execution>
<phase>package</phase>
<goals>
<goal>test-jar</goal>
</goals>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>com.crawljax.cli.JarRunner</mainClass>
</manifest>
</archive>
</configuration>
</execution>
</executions>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>com.crawljax.cli.JarRunner</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
<goal>test-jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.1</version>
<executions>
<execution>
<id>default-deploy</id>
<phase>deploy</phase>
<goals>
<goal>deploy</goal>
</goals>
<configuration>
<file>crawljax-cli-3.7-SNAPSHOT.zip</file>
<packaging>zip</packaging>
</configuration>
</execution>
</executions>
<configuration>
<file>crawljax-cli-3.7-SNAPSHOT.zip</file>
<packaging>zip</packaging>
</configuration>
</plugin>
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<version>2.1.10</version>
<executions>
<execution>
<goals>
<goal>revision</goal>
</goals>
<configuration>
<dateFormat>yyyy-MM-dd HH:mm:ss z</dateFormat>
<verbose>false</verbose>
<generateGitPropertiesFile>true</generateGitPropertiesFile>
<gitDescribe>
<always>true</always>
<abbrev>7</abbrev>
<dirty>-dirty</dirty>
</gitDescribe>
</configuration>
</execution>
</executions>
<configuration>
<dateFormat>yyyy-MM-dd HH:mm:ss z</dateFormat>
<verbose>false</verbose>
<generateGitPropertiesFile>true</generateGitPropertiesFile>
<gitDescribe>
<always>true</always>
<abbrev>7</abbrev>
<dirty>-dirty</dirty>
</gitDescribe>
</configuration>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<id>default-clean</id>
<phase>clean</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>default-testResources</id>
<phase>process-test-resources</phase>
<goals>
<goal>testResources</goal>
</goals>
</execution>
<execution>
<id>default-resources</id>
<phase>process-resources</phase>
<goals>
<goal>resources</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<executions>
<execution>
<id>default-compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>default-testCompile</id>
<phase>test-compile</phase>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
<executions>
<execution>
<id>default-test</id>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.1</version>
<executions>
<execution>
<id>default-install</id>
<phase>install</phase>
<goals>
<goal>install</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.3</version>
<executions>
<execution>
<id>default-site</id>
<phase>site</phase>
<goals>
<goal>site</goal>
</goals>
<configuration>
<outputDirectory>/home/roper/idp-business-logic/crawljax-mainline/crawljax/cli/target/site</outputDirectory>
<reportPlugins>
<reportPlugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
</reportPlugin>
</reportPlugins>
</configuration>
</execution>
<execution>
<id>default-deploy</id>
<phase>site-deploy</phase>
<goals>
<goal>deploy</goal>
</goals>
<configuration>
<outputDirectory>/home/roper/idp-business-logic/crawljax-mainline/crawljax/cli/target/site</outputDirectory>
<reportPlugins>
<reportPlugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
</reportPlugin>
</reportPlugins>
</configuration>
</execution>
</executions>
<configuration>
<outputDirectory>/home/roper/idp-business-logic/crawljax-mainline/crawljax/cli/target/site</outputDirectory>
<reportPlugins>
<reportPlugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
</reportPlugin>
</reportPlugins>
</configuration>
</plugin>
</plugins>
</build>
<reporting>
<outputDirectory>/home/roper/idp-business-logic/crawljax-mainline/crawljax/cli/target/site</outputDirectory>
</reporting>
</project>

GWT Module ... not found in project sources or resources

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.

Classpath on JavaFX using javafxpackager

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>

Categories

Resources