We are using GWT in our product with mojo gwt-maven-plugin 2.4 to compile the GWT code.
But we observed that when we run mvn install, the gwt maven plugin is running the permutations even when no code changes are made to GWT code.
After struggling on this issue for quite some time, we were able to reproduce it with a simple setup using 2 maven projects:
1st project(MyGwtMavenSampleSource) : Contains the GWT code along with the gwt module xml file
2nd project (MavenBuilderMod): Contains the MyGwtMavenSampleSource as maven dependency and will build the war
file.
Below are the poms for both the projects:
1st Project: MyGwtMavenSampleSource
<?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>GWTMavenPlugin</groupId>
<artifactId>MyGwtMavenSampleSource</artifactId>
<packaging>jar</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>GWT Maven Archetype</name>
<properties>
<!-- Convenience property to set the GWT version -->
<gwtVersion>2.4.0</gwtVersion>
<!-- GWT needs at least java 1.5 -->
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>${gwtVersion}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwtVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
<classifier>sources</classifier>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.*</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.*</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
2nd Project: MavenBuilderMod
<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>GWTMavenPlugin</groupId>
<artifactId>MavenBuilderMod</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<properties>
<!-- Convenience property to set the GWT version -->
<gwtVersion>2.4.0</gwtVersion>
<!-- GWT needs at least java 1.5 -->
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>${gwtVersion}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwtVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
<classifier>sources</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>GWTMavenPlugin</groupId>
<artifactId>MyGwtMavenSampleSource</artifactId>
<version>0.0.1-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
<executions>
<execution>
<id>src-dependencies</id>
<phase>package</phase>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<classifier>sources</classifier>
<failOnMissingClassifierArtifact>false</failOnMissingClassifierArtifact>
<outputDirectory>${project.build.directory}/sources</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<!-- GWT Maven Plugin -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>2.4.0</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
<!-- Plugin configuration. There are many available options, see
gwt-maven-plugin documentation at codehaus.org -->
<configuration>
<runTarget>MyGwtMavenSampleSource.html</runTarget>
<hostedWebapp>${webappDirectory}</hostedWebapp>
<modules>
<module>com.ca.gwt.maven.sample.MyGwtMavenSampleSource</module>
</modules>
</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>
</execution>
</executions>
<configuration>
<webappDirectory>${webappDirectory}</webappDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
So, the question is, how can we make gwt-maven-plugin / compiler to run the permutations only on code change in this kind of setup.
Note: This works as expected (i.e permutations are run only when the code is changed) if gwt module xml file is placed in the same maven module that contains the gwt-maven-plugin
The root issue is Maven's broken support for incremental builds, and possibly broken incremental-build support in the gwt-maven-plugin (particularly if you're still using a more-than-2-year-old version!).
The gwt-maven-plugin somehow sees that the gwt.xml file has changed (track the build of your first module, ideally it should really be a no-op if nothing changed; re-copying the resources and/or rebuilding the JAR would probably be enough to trigger the issue downwards), and particularly is more recent than the nocache.js file it produced.
I think a better setup is to run the gwt-maven-plugin in the first module and package everything in a ZIP or WAR, that you can then use as a WAR overlay. It unfortunately makes running DevMode a bit harder, but it's workable.
Related
I am trying to compile a Maven project named web-server which is dependent on search-client within the specified dependency version range [2.0,3.0). The compile fails however due to a "No versions available for > com.test.search:search-client:jar:[2.0,3.0) within specified range" in the repository.
These are the steps I am following:
Make my changes and build search-client locally
This builds a 2.0-SNAPSHOT jar for this client pom in my local m2 repository.
Try to build web-server which is dependent on the above
This does not compile giving the following error:
[ERROR] Failed to execute goal on project common: Could not resolve
dependencies for project com.test.web:common:jar:2.0-SNAPSHOT: Failed
to collect dependencies at
com.test.search:search-client:jar:[2.0,3.0): No versions available for
com.test.search:search-client:jar:[2.0,3.0) within specified range ->
[Help 1]
Web Server POM:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>web-parent</artifactId>
<groupId>com.test.web</groupId>
<version>2.0-SNAPSHOT</version>
</parent>
<artifactId>common</artifactId>
<packaging>jar</packaging>
<properties>
<kotlin.version>1.3.61</kotlin.version>
</properties>
<dependencies>
<dependency>
<groupId>com.test.search</groupId>
<artifactId>search-client</artifactId>
<version>[2.0,3.0)</version>
</dependency>
.
.
.
//Many More Dependencies
</dependencies>
<build>
<sourceDirectory>src/main/kotlin</sourceDirectory>
<testSourceDirectory>src/test/kotlin</testSourceDirectory>
<!--<testSourceDirectory>src/test/kotlin</testSourceDirectory>-->
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>test-compile</id>
<phase>test-compile</phase>
<goals>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
<configuration>
<jvmTarget>1.8</jvmTarget>
</configuration>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
</plugins>
</reporting>
</project>
search-client POM:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>search-parent</artifactId>
<groupId>com.test.search</groupId>
<version>2.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>search-client</artifactId>
<packaging>jar</packaging>
<name>test Search Client</name>
<dependencies>
<!-- test Search -->
<dependency>
<groupId>com.test.search</groupId>
<artifactId>search-api</artifactId>
<version>${project.parent.version}</version>
</dependency>
<!-- test -->
<dependency>
<groupId>com.test.common</groupId>
<artifactId>common-client</artifactId>
</dependency>
<!-- Languages & Frameworks -->
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
</dependency>
<!-- Utils -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
<!-- Testing -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-test-junit</artifactId>
<scope>test</scope>
</dependency>
<!-- Codecs -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-kotlin</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
</plugin>
<plugin>
<artifactId>kotlin-maven-plugin</artifactId>
<groupId>org.jetbrains.kotlin</groupId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Does 2.0-SNAPSHOT not lie in [2.0,3.0)? I have been strictly asked not to increase the version. Also, how can I go about local development in such maven dependency design?
Please help, I am stuck!
Many thanks in advance :)
According to POM Reference, Version Order Specification:
"1-snapshot" < "1" < "1-sp" (qualifier padding)
2.0-SNAPSHOT is less than 2.0, which always was in Maven: snapshot versions are the pre-versions of the next release version.
So, no, 2.0-SNAPSHOT does not lie in [2.0,3.0) (2.0 <= x < 3.0). (1,3.0) (1 < x < 3.0) should do it.
And, there's a typo in your Web Server POM:
<version>_____3,0)</version>
Since I need to download a lot of jars/dependencies to create a special JRE distribution for special application, to avoid to download on maven repository web site.
I created an project on Maven, put my dependencies on pom.xml and it has been downloaded all jars "~.m2/repository" (user folder) but it's very difficult to get jar by jar of the ".m2/repository" folder, and I really dont know what my project uses since this folder contains all jars from all projects.
Has any magic command copy only the jars of my project needs?
Yes,
As you did, create a app, edit you pom.xml, and put all your dependencies into dependencies block.
<dependencies>
<dependency>
<groupId>org.deeplearning4j</groupId>
<artifactId>deeplearning4j-core</artifactId>
<version>1.0.0-beta5</version>
</dependency>
<dependency>
<groupId>org.deeplearning4j</groupId>
<artifactId>deeplearning4j-modelimport</artifactId>
<version>1.0.0-beta5</version>
</dependency>
<dependency>
<groupId>org.nd4j</groupId>
<artifactId>nd4j-native-platform</artifactId>
<version>1.0.0-beta5</version>
</dependency>
<dependency>
<groupId>com.google.cloud.dataflow</groupId>
<artifactId>google-cloud-dataflow-java-sdk-all</artifactId>
<version>2.5.0</version>
</dependency>
</dependencies>
Then ou can create your package, open a terminal navigate to your project and execute the command:
mvn package
After the BUILD you can copy only the jars that the project uses (also all dependencies), using the next command:
mvn dependency:copy-dependencies
And check the folder "target/dependency" and all jars will be stored into this folder, and you can copy this for your JRE/lib/ext.
You can use maven-dependency-plugin for this. See below sample pom.xml file.
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>
<groupId>org.learn</groupId>
<artifactId>stack-overflow</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.dbunit</groupId>
<artifactId>dbunit</artifactId>
<version>2.6.0</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy</id>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
</execution>
</executions>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.dbunit</groupId>
<artifactId>dbunit</artifactId>
<version>2.6.0</version>
<overWrite>false</overWrite>
</artifactItem>
<artifactItem>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</artifactItem>
</artifactItems>
<outputDirectory>C:/Temp</outputDirectory>
</configuration>
</plugin>
</plugins>
</build>
</project>
For more details on using this plugin, hear over to
https://maven.apache.org/plugins/maven-dependency-plugin/examples/copying-artifacts.html
Edit:
Sorry, since you want to copy all the dependencies, you can use below configuration.
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>
<groupId>org.learn</groupId>
<artifactId>stack-overflow</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.dbunit</groupId>
<artifactId>dbunit</artifactId>
<version>2.6.0</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>C:/Temp</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
<excludeTransitive>true</excludeTransitive><!-- Use this if you want
to copy only the dependencies that you deplacred. -->
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
I'm trying to build a multi-module maven project in Eclipse, however, I get 8670 Java Problems in Eclipse Oxygen. My project has one parent project with its pom.xml that has the following secion declaring sub-modules:
<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>org.neo4j</groupId>
<artifactId>graph-algorithms-parent</artifactId>
<version>3.3.2.0</version>
<packaging>pom</packaging>
<name>Neo4j Graph Algorithms</name>
<description>Efficient Graph Algorithms for Neo4j</description>
<profiles>
<profile>
<id>Benchmark</id>
<modules>
<module>benchmark</module>
</modules>
</profile>
</profiles>
<modules>
<module>core</module>
<module>algo</module>
<module>tests</module>
</modules>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<neo4j.version>3.3.1</neo4j.version>
<jmh.version>1.19</jmh.version>
<javac.target>1.8</javac.target>
</properties>
<organization>
<name>Neo4j, Inc.</name>
<url>https://neo4j.com</url>
</organization>
<developers>
<developer>
<id>neo-technology</id>
<organization>Neo4j, Inc.</organization>
<url>https://neo4j.com</url>
</developer>
<developer>
<id>avgl</id>
<organization>Avantgarde Labs GmbH</organization>
<url>https://avantgarde-labs.de</url>
</developer>
</developers>
<url>https://github.com/neo4j-contrib/neo4j-graph-algorithms</url>
<scm>
<url>https://github.com/neo4j-contrib/neo4j-graph-algorithms</url>
</scm>
<licenses>
<license>
<name>GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007</name>
<url>https://www.gnu.org/licenses/gpl.txt</url>
<comments>
Note that this license is for the project itself, and not for its dependencies.
See the included NOTICE.txt file for further details.
</comments>
<distribution>repo</distribution>
</license>
</licenses>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j</artifactId>
<version>${neo4j.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-kernel</artifactId>
<version>${neo4j.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-io</artifactId>
<version>${neo4j.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.biville.florent</groupId>
<artifactId>neo4j-sproc-compiler</artifactId>
<version>1.2</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<!-- Benchmark Dependencies -->
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-core</artifactId>
<version>${jmh.version}</version>
</dependency>
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-generator-annprocess</artifactId>
<version>${jmh.version}</version>
<scope>provided</scope>
</dependency>
<!-- Test Dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<!-- Neo4j Procedures require Java 8 -->
<compilerVersion>${javac.target}</compilerVersion>
<source>${javac.target}</source>
<target>${javac.target}</target>
</configuration>
</plugin>
<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</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
<configuration>
<additionalparam>-Xdoclint:none</additionalparam>
</configuration>
</plugin>
<plugin>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctor-maven-plugin</artifactId>
<version>1.5.3</version>
<inherited>false</inherited>
<executions>
<execution>
<id>generate-docs</id>
<phase>package</phase>
<goals>
<goal>process-asciidoc</goal>
</goals>
</execution>
</executions>
<configuration>
<backend>html5</backend>
<!--preserveDirectories>true</preserveDirectories -->
<imagesDir>images</imagesDir>
<sourceDirectory>${basedir}/doc</sourceDirectory>
<sourceDocumentName>index.adoc</sourceDocumentName>
<outputDirectory>${basedir}/target/docs</outputDirectory>
<attributes>
<neo4j-version>${project.version}</neo4j-version>
</attributes>
<requires>
<require>asciidoctor-diagram</require>
</requires>
<source-highlighter>coderay</source-highlighter>
<coderay-css>style</coderay-css>
</configuration>
<dependencies>
<dependency>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctorj-diagram</artifactId>
<version>1.3.1</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>com.mycila.maven-license-plugin</groupId>
<artifactId>maven-license-plugin</artifactId>
<version>1.10.b1</version>
<configuration>
<header>gplv3-header.txt</header>
<strictCheck>true</strictCheck>
<failIfMissing>true</failIfMissing>
<includes>
<include>**/*.java</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
Then I have the 4 sub-modules benchmark, core, algo, tests with their own pom.xml all referencing the parent project correctly (with the correct version number). The actual project is from neo4j which you can find here.
I tried doing a maven clean install and the project builds successfully without any issues. However, when I import the projects to Eclipse, I get many errors (mostly from the parent project) that states either ... cannot be resolved to a type or ... cannot be resolved.
I tried doing a Maven -> Update Project without any success. I'm in the Project Explorer view in Eclipse with all 5 projects at the same level.
I also tried adding a Active Maven Profiles in Eclipse, however, did not resolve the issue. My Embedded Maven version is 3.3.9/1.8.2.20171007-0216
I found the issue. Problem was, my Eclipse workspace was the directory called workspace. However, my maven projects were in a subfolder I created called my_project. When I cloned the repo, I cd into my_project and did git clone.
So, instead of choosing the highest level workspace folder as my Eclipse workspace, I chose the /workspace/my_project as workspace and the issue resolved.
I have a Maven web project in which I must run some Selenium UI tests (with JUnit). However, when I build the project (goals: “clean install”) the Selenium tests don’t work because the Tomcat server hasn’t started yet.
I have added a plugin snippet that I found online (the tomcat7-maven-plugin) but it doesn’t seem to do anything.
It might be important to know that my Selenium tests use a Firefox driver with a different binary from my default Firefox install (an older version of Firefox portable to work with the older version of Selenium).
This is my POM.XML file:
<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>org.web3</groupId>
<artifactId>WebShopWeb3</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>tomcat-run</id>
<goals>
<goal>run-war-only</goal>
</goals>
<phase>pre-integration-test</phase>
<configuration>
<port>8080</port>
<fork>true</fork>
</configuration>
</execution>
<execution>
<id>tomcat-shutdown</id>
<goals>
<goal>shutdown</goal>
</goals>
<phase>post-integration-test</phase>
</execution>
</executions>
</plugin>
</plugins>
<finalName>WebShopWeb3</finalName>
</build>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.4.1211.jre7</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>2.53.0</version>
</dependency>
</dependencies>
</project>
My project (the tests are highlighted):
Does anybody know the lines I need to add to my POM.XML or other things I need to do?
Thanks
I have a simple app with selenium. Here 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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.foo</groupId>
<artifactId>foo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Foo App</name>
<description>Test Scenario For Foo</description>
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.45.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
I quite stuck with something I think is basic, but Maven does not enable me to package my project twice without doing some cleaning.
I'm working on a java project with multi-dependencies (different modules developped by different people, usual stuff) and one of them uses java classes generated using JAXB.
I'm using maven to make all that work together (one pom per module and one pom parent to built the whole project, basic stuff I said).
When I package the modules using dedicated pom there is no trouble (even if I do several successive package without cleaning). When I package the whole project for the first time (or after a clean) there is no problem at all too (*.java generated from XSDs, *.class, tests executed, Jar generated properly).
But now, if I re-do the package command, then maven says that it cannot find the classes generated using JAXB (and, then there are compilation issues in other java classes due to symbols that cannot be found, logic).
I think that Maven kind of "forgot" that it generated java classes during previous package but I don't know how to make it remember. So, up to now, I'm obliged to make it generate those classes and delete them, again and again (and its quite long as the clean cleans every other modules that will then be built again...).
So, if anyone has any clue on what I'm missing/doing wrong, I would be glad as none of my search here and there were successful.
I hope that I was clear enough. If not, feel free to ask for further explanation.
Thank you
P.S. I forgot to tell you that I'm using Maven with command line
EDIT :
Parent POM
<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>my.package.for.mysoft</groupId>
<artifactId>mysoft-parent</artifactId>
<packaging>pom</packaging>
<version>1.3.0-SNAPSHOT</version>
<name>Main parent for MySoft modules</name>
<properties>
<mysoft_version>1.3.0-SNAPSHOT</mysoft_version>
<main_other_soft_version>1.3.1</main_other_soft_version>
<!-- SCADAsoft packages -->
<scadasoft.version>6.2.4.4</scadasoft.version>
<!-- Hypervisor packages -->
<othersoft2.version>2.9.0_P03</othersoft2.version>
<othersoft1.version>1.8.0_P03</othersoft1.version>
<othersoft3.version>1.2.8</othersoft3.version>
<hv.quartz-tc.version>2.2.1</hv.quartz-tc.version>
<!-- TVS packages -->
<tvs.common.version>3.6.5.0001</tvs.common.version>
<!-- Loggers -->
<slf4j.version>1.7.2</slf4j.version>
<log4j.version>1.2.17</log4j.version>
</properties>
<modules>
<module>mysoft-bom</module>
<module>mysoft-jaxb</module>
<module>mysoft-common</module>
<module>My-project-that-uses-jaxb-generated-classes</module>
</modules>
<distributionManagement>
<snapshotRepository>
<id>soft-repo-releases</id>
<name>SOFT maven repository - SNAPSHOTS</name>
<url>http://url.of.the.server:123/nexus/content/repositories/mysoft_snapshots/</url>
</snapshotRepository>
<repository>
<id>soft-repo-releases</id>
<name>Soft maven repository - RELEASES</name>
<url>http://url.of.the.server:123/nexus/content/repositories/mysoft_releases/</url>
</repository>
</distributionManagement>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.terracotta.quartz</groupId>
<artifactId>quartz-terracotta</artifactId>
<version>${hv.quartz-tc.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
<configuration>
<deployAtEnd>false</deployAtEnd>
<skip>false</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.4.1</version>
<executions>
<execution>
<id>enforce-parent-version</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireProperty>
<property>project.parent.version</property>
<regex>1.3.0.SNAPSHOT</regex>
</requireProperty>
</rules>
<fail>true</fail>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
Pom of the module that generates java classes
<?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>
<artifactId>mysoft-jaxb</artifactId>
<packaging>jar</packaging>
<parent>
<groupId>my.package.for.mysoft</groupId>
<artifactId>mysoft-parent</artifactId>
<version>1.3.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<name>MySoft generated classes</name>
<description>Classes generated by JAXB</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<othersoft1.version>1.8.0</othersoft1.version>
<othersoft2.version>2.9.0</othersoft2.version>
<othersoft3.version>1.2.8</othersoft3.version>
<mysoft.data.model>${main_other_soft_version}</mysoft.data.model>
<mysoft.common>${main_other_soft_version}</mysoft.common>
<mysoft.core>${main_other_soft_version}</mysoft.core>
<skipTests>false</skipTests>
</properties>
<distributionManagement>
<snapshotRepository>
<id>soft-repo-releases</id>
<name>Soft maven repository - SNAPSHOTS</name>
<url>http://url.of.the.server:123/nexus/content/repositories/mysoft_snapshots/</url>
</snapshotRepository>
<repository>
<id>soft-repo-releases</id>
<name>Soft maven repository - RELEASES</name>
<url>http://url.of.the.server:123/nexus/content/repositories/mysoft_releases/</url>
</repository>
</distributionManagement>
<dependencies>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics</artifactId>
<version>0.6.5</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<environmentVariables>
<PATH>${java.library.path};${my_api_dir}\Bin;${project.basedir}\..\module-with-cpp\target\nar\lib\x86-Windows-msvc\jni</PATH>
</environmentVariables>
<argLine>-Xmx1024m</argLine>
</configuration>
</plugin>
<!-- Maven Compiler plugin: Inherited from Parent -->
<!-- Maven Jar plugin: Inherited from Parent -->
<!-- Maven Check Style Plugin: Inherited from Parent -->
<!-- Maven Assembly Plugin Plugin: Inherited from Parent -->
<!-- Maven JavaDoc Plugin: Inherited from Parent -->
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.4.1</version>
</plugin>
<!-- generation of java classes using JAXB -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>xjc</id>
<goals>
<goal>xjc</goal>
</goals>
</execution>
</executions>
<configuration>
<sources>
<source>${project.build.sourceDirectory}/../resources/xsd/config.xsd</source>
</sources>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<excludes>
<exclude>system_configuration/**</exclude>
<exclude>mysoft.properties</exclude>
<exclude>connector_configuration.xml</exclude>
<exclude>log4j.xml</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</project>
Module that uses the one with JAXB generated java classes
<?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>
<artifactId>My-project-that-uses-jaxb-generated-classes</artifactId>
<packaging>jar</packaging>
<parent>
<groupId>my.package.for.mysoft</groupId>
<artifactId>mysoft-parent</artifactId>
<version>1.3.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<name>My project module 1</name>
<description>Module that uses Jaxb generated classes</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<othersoft1.version>1.8.0</othersoft1.version>
<othersoft2.version>2.9.0</othersoft2.version>
<othersoft3.version>1.2.8</othersoft3.version>
<mysoft.data.model>${main_other_soft_version}</mysoft.data.model>
<mysoft.common>${main_other_soft_version}</mysoft.common>
<mysoft.core>${main_other_soft_version}</mysoft.core>
<skipTests>false</skipTests>
</properties>
<distributionManagement>
<snapshotRepository>
<id>soft-repo-releases</id>
<name>Soft maven repository - SNAPSHOTS</name>
<url>http://url.of.the.server:123/nexus/content/repositories/mysoft_snapshots/</url>
</snapshotRepository>
<repository>
<id>soft-repo-releases</id>
<name>Soft maven repository - RELEASES</name>
<url>http://url.of.the.server:123/nexus/content/repositories/mysoft_releases/</url>
</repository>
</distributionManagement>
<dependencies>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>dependency.package.1</groupId>
<artifactId>connector-sdk-impl</artifactId>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
</dependency>
<!-- datamodels -->
<dependency>
<groupId>dependency.package.1</groupId>
<artifactId>data-model-1</artifactId>
<version>3.6.5.0001</version>
</dependency>
<dependency>
<groupId>dependency.package.2</groupId>
<artifactId>data-model-2</artifactId>
<version>${scadasoft.version}</version>
</dependency>
<!--
...
-->
<dependency>
<groupId>my.package.for.mysoft</groupId>
<artifactId>mysoft-common</artifactId>
<version>${mysoft_version}</version>
</dependency>
<dependency>
<groupId>my.package.for.mysoft</groupId>
<artifactId>mysoft-jaxb</artifactId>
<version>${mysoft_version}</version>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<environmentVariables>
<PATH>${java.library.path};${my_api_dir}\Bin;${project.basedir}\..\module-with-cpp\target\nar\lib\x86-Windows-msvc\jni</PATH>
</environmentVariables>
<argLine>-Xmx1024m</argLine>
</configuration>
</plugin>
<!-- Maven Compiler plugin: Inherited from Parent -->
<!-- Maven Jar plugin: Inherited from Parent -->
<!-- Maven Check Style Plugin: Inherited from Parent -->
<!-- Maven Assembly Plugin Plugin: Inherited from Parent -->
<!-- Maven JavaDoc Plugin: Inherited from Parent -->
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.4.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<excludes>
<exclude>system_configuration/**</exclude>
<exclude>mysoft.properties</exclude>
<exclude>connector_configuration.xml</exclude>
<exclude>log4j.xml</exclude>
</excludes>
</configuration>
</plugin>
<!-- One of the dependencies uses C++ -->
<plugin>
<groupId>com.github.maven-nar</groupId>
<artifactId>nar-maven-plugin</artifactId>
<extensions>true</extensions>
<executions>
<execution>
<id>nar-download</id>
<goals>
<goal>nar-download</goal>
</goals>
</execution>
<execution>
<id>nar-test-unpack</id>
<goals>
<goal>nar-test-unpack</goal>
</goals>
</execution>
<execution>
<id>nar-integration-test</id>
<goals>
<goal>nar-integration-test</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>