Import maven project but parent module disabled - java

I would like to import this project in my ecplise workspace:
https://github.com/steinsag/gwt-maven-example
structure of the project is:
gwt-maven-example-master
pom.xml
server
pom.xml
...
shared
pom.xml
...
web
pom.xml
...
parent 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>
<groupId>de.hpfsc</groupId>
<artifactId>parent</artifactId>
<packaging>pom</packaging>
<version>1.0.0-SNAPSHOT</version>
<modules>
<module>server</module>
<module>shared</module>
<module>web</module>
</modules>
<properties>
<gwtVersion>2.5.0</gwtVersion>
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<tomcat.webport>8082</tomcat.webport>
<tomcat.ajpport>8182</tomcat.ajpport>
<tomcat.context>/parent</tomcat.context>
</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>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>2.5.0-rc2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.0</version>
<configuration>
<path>${tomcat.context}</path>
<port>${tomcat.webport}</port>
<ajpPort>${tomcat.ajpport}</ajpPort>
<systemProperties>
<JAVA_OPTS>-XX:MaxPermSize=256m</JAVA_OPTS>
</systemProperties>
</configuration>
</plugin>
</plugins>
</build>
</project>
When I try to import the folder containing this pom into eclipse, it allows me to select the children folder but not the parent itself.
Why can't import the parent pom?
I've tried to create a parent folder, put the pom.xml inside and reference other modules using ../server and it doesn't work.
I've tried to remove the code related to the tomcat configuration from the parent pom and it doesn't work either.
Thanks

You'll need the m2e plugin installed (you may already have this depending on the version of eclipse). I guess at the moment you are doing "import" then "Existing Projects into Workspace", but instead you need to select "Existing Maven Projects". This will allow you to select the parent pom and also the child modules.

Related

How to define and use the ${project.basedir} using maven?

I am trying to better understand how to resolve relative paths in maven. I have seen here "Resolving Relative Paths." that is a good practice to use the project.getBasedir() to get paths.
Initially I thought I did not have to set, so I created a maven project created a TestClass.java and tested the following:
In TestClass.java
System.out.println(project.getBaseDir());
System.out.println(project.getBaseDir()+"/folder1/folder2");
This generated me the error: Cannot resolve symbol 'project'.
So I thought I must modify my pom, but how to modify my pom?
Also, what is the best practice to concatenate paths in maven how could one improve this project.getBaseDir()+"/folder1/folder2"?
Below is my 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">
<modelVersion>4.0.0</modelVersion>
<groupId>com.moga</groupId>
<artifactId>capacityplan</artifactId>
<version>1.0-SNAPSHOT</version>
<name>capacityplan</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- <maven.compiler.source>1.7</maven.compiler.source> -->
<!-- <maven.compiler.target>1.7</maven.compiler.target> -->
<maven.compiler.release>15</maven.compiler.release>
</properties>
<dependencies>
<!-- TODO:Remove Junit4-->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.7.2</version>
<scope>test</scope>
</dependency>
<!-- Start as per Junit5 Doc https://junit.org/junit5/docs/current/user-guide/#running-tests-build-maven-engines-configure-->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.7.2</version>
<scope>test</scope>
</dependency>
<!-- End -->
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>5.7.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.moga</groupId>
<artifactId>genetic</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<!-- <sourceDirectory>${basedir}/src/main/java</sourceDirectory>-->
<!-- <testSourceDirectory>${basedir}/src/test/java</testSourceDirectory>-->
<!-- <outputDirectory>${basedir}/target/classes</outputDirectory>-->
<!-- <testOutputDirectory>${basedir}/target/test-classes</testOutputDirectory>-->
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>
<!-- Define Main class, see https://www.baeldung.com/maven-java-main-method -->
<plugin>
<groupId>com.moga</groupId>
<artifactId>capacityplan</artifactId>
<version>1.0-SNAPSHOT</version>
<configuration>
<mainClass>com.moga.planning.nsga2.RunCapacityPlanning</mainClass>
</configuration>
</plugin>
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
<!-- As per Junit5 Doc https://junit.org/junit5/docs/current/user-guide/#running-tests-build-maven-engines-configure-->
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.2</version>
</plugin>
<!-- End Junit5-->
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>

maven build succeeds, but eclipse build fails

I have an Eclipse / Maven project: The build with Maven succeeds, but Eclipse does have compile-time errors and cannot build.
My Eclipse is Neon (4.6.3) and I am using the build-in Maven and JDK 1.8
Could you help me solve the problem?
My pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>seller</groupId>
<artifactId>home.digest</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>home.digest Maven Webapp</name>
<!-- FIXME change it to the project's website -->
<url>http://maven.apache.org</url>
<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>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.8</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpcore -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.11</version>
</dependency>
<dependency>
<!-- jsoup HTML parser library # https://jsoup.org/ -->
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.11.3</version>
</dependency>
</dependencies>
<build>
<finalName>home.digest</finalName>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<!-- see http://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_war_packaging -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
Eclipse fails to recognize the following imports in a class:
import org.apache.http.HttpEntity;
import org.apache.http.HttpHost;
import org.apache.http.protocol.HttpContext;
The Eclipse project has the following properties:
The problem was, that the jar file was corrupt:
[ERROR] error reading C:\Users\User.m2\repository\org\apache\httpcomponents\httpcore\4.4.11\httpcore-4.4.11.jar; invalid LOC header (bad signature)
I solved the problem by replacing the dependency
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.11</version>
</dependency>
by the dependency on an earlier version:
4.4.10
Hello
First of all, You should check to contain the apache jar file your maven local folder. Some version folder have in your local maven folder. But doesn't have jar file.
OR
this line code add to your pom.xml file.
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.6</version>
</dependency>

Maven upgraded DROOLS version and now can no longer build

I am new to maven and java. I am working on a Java/DROOLS project. I was experiencing errors which seemed to be fixed with the next version of DROOLS. I changed the version in my pom.xml and then did mvn package.
The files were downloaded but every line of code that references DROOLS throws a compile error of package org.drools does not exist.
[ERROR] /C:/Dev/src/main/java/com/company/project/drools/client/DroolsRulesRunner.java:[11,18] package org.drools does not exist
[ERROR] /C:/Dev/src/main/java/com/company/project/drools/client/DroolsRulesRunner.java:[12,29] package org.drools.definition does not exist
Any help would be greatly appreciated.
Edit
Here is my pom.xml.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.bericotechnologies</groupId>
<artifactId>sbt-rules</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>my-app</name>
<url>http://maven.apache.org</url>
<properties>
<drools.version>7.6.0.Final</drools.version>
<jbpm5.version>7.6.0.Final</jbpm5.version>
</properties>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<version>1.7.12</version>
</dependency>
<dependency>
<groupId>org.jbpm</groupId>
<artifactId>jbpm-flow</artifactId>
<version>${jbpm5.version}</version>
</dependency>
<dependency>
<groupId>org.jbpm</groupId>
<artifactId>jbpm-bpmn2</artifactId>
<version>${jbpm5.version}</version>
</dependency>
<dependency>
<groupId>org.jbpm</groupId>
<artifactId>jbpm-flow-builder</artifactId>
<version>${jbpm5.version}</version>
</dependency>
<dependency>
<groupId>pl.maciejwalkowiak</groupId>
<artifactId>junit-drools</artifactId>
<version>1.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.9</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
<version>${drools.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.core</artifactId>
<version>2.6.3</version>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc4</artifactId>
<version>4.0</version>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc</artifactId>
<version>4.0</version>
</dependency>
<dependency>
<groupId>org.rzo.yajsw</groupId>
<artifactId>wrapper</artifactId>
<version>11.11</version>
</dependency>
<dependency>
<groupId>org.rzo.yajsw</groupId>
<artifactId>wrapperApp</artifactId>
<version>11.11</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>jboss</id>
<name>jboss</name>
<url>https://repository.jboss.org/nexus/content/groups/public/</url>
</repository>
<repository>
<id>maciejwalkowiak.pl</id>
<url>https://github.com/maciejwalkowiak/maven-repo/raw/releases/</url>
</repository>
</repositories>
<build>
<resources>
<resource>
<directory>src/main/rules</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>com.google.code.sortpom</groupId>
<artifactId>maven-sortpom-plugin</artifactId>
<version>2.3.0</version>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>sort</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>com.berico.psip.run.RunDroolsService</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
The only thing that I changed is
<properties>
<drools.version>5.6.0.Final</drools.version>
<jbpm5.version>5.5.0.Final</jbpm5.version>
</properties>
to
<properties>
<drools.version>7.6.0.Final</drools.version>
<jbpm5.version>7.6.0.Final</jbpm5.version>
</properties>
If I change it back everything works fine. I can see the 7.6.0.Final jars in the repository.
You have broken imports and you have to fix them.
There's changes in the package structure of Drools between versions 5.6.0.Final and 7.6.0.Final. The package "definitions" is now under org.drools.core.definitions (v7.6.0.Final) and not under org.drools.definitions (5.6.0.Final).
You need to remove all imports beginning with org.drools in your classes and re-import the missing Drools classes again with the new package locations - those from version 7.6.0.Final.

gwt-maven-plugin runs permutations even when there are no changes

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.

dependencies.dependency.version' is missing error

I am trying to create a bundle using apache maven. When I run mvn clean install command it is giving the below error:
dependencies.dependency.version' is missing for
javax.servlet:servlet-api.jar
I have placed that ‘servlet-api.jar’ inside resource folder of my project
Could any anyone please tell where should I place that jar file?
UPDATE:
Here is my pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>felix-parent</artifactId>
<groupId>org.apache.felix</groupId>
<version>2.1</version>
<relativePath>../pom/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.4.1-SNAPSHOT</version>
<packaging>maven-plugin</packaging>
<name>Maven Bundle Plugin</name>
<description>
Provides a maven plugin that supports creating an OSGi bundle
from the contents of the compilation classpath along with its
resources and dependencies. Plus a zillion other features.
The plugin uses the Bnd tool (http://www.aqute.biz/Code/Bnd)
</description>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/felix/trunk/bundleplugin</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/felix/trunk/bundleplugin</developerConnection>
<url>http://svn.apache.org/repos/asf/felix/trunk/bundleplugin</url>
</scm>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<!-- Provided APIs -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</dependency>
</dependencies>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-changes-plugin</artifactId>
<version>2.9</version>
<configuration>
<component>12311143</component>
<versionPrefix>maven-bundle-plugin-</versionPrefix>
<statusIds>Resolved,Closed</statusIds>
<maxEntries>1000</maxEntries>
<issueManagementSystems>
<issueManagementSystem>JIRA</issueManagementSystem>
</issueManagementSystems>
<useJql>true</useJql>
</configuration>
</plugin>
</plugins>
</reporting>
</project>
Thanks
Anderson
You haven't added the version tag in dependency.
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>1.0.0</version> //Add the version.
</dependency>
I had this same error for a slightly different reason.
My project uses dependency management (has 2 <dependencyManagement> sections for some reason) and has many modules and sub-modules.
Top level pom had:
<dependencyManagement>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.10</artifactId>
<version>${spark.version}</version>
</dependency>
</dependencyManagement>
Sub-level pom had
<dependencyManagement>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.10</artifactId>
<scope>provided</scope>
</dependency>
</dependencyManagement>
Leaf pom had
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.10</artifactId>
</dependency>
To fix it I removed the <dependencyManagement> section from the mid-level pom and changed the leaf pom to have
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.10</artifactId>
<scope>provided</scope>
</dependency>
The message is quite clear: inside the dependencies element of your pom, you have a dependency element with the artefact javax.servlet:servlet-api.jar. And inside this dependency element, there must be a version element, but you didn't provide it.
<dependencies>
<!-- Provided APIs -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<!-- missing version here: -->
<version>3.0</version>
</dependency>
</dependencies>
Note that 3.0 is just an example. Provide the right version.

Categories