Eclipse Helios + maven m2e + Groovy == FAIL - eclipse

Ever since I've installed the new m2e plugin for maven, my Groovy project no longer builds. I'm using the groovy-compiler-plugin as described here. I get the old "plugin execution not covered..." error for the maven-compiler-plugin. I've tried both execute and ignore for the goals "testCompile" and "compile" as described in the error.
I can't use GMaven due to some arcane compiler issues. I also am locked to Maven 2.2.1 due to my company's build process. The old m2eclipse plugin is gone, and the documentation for m2e is atrocious.
I am at my wits end with this. Nowhere else do I see this issue. I can't be the only one.
If I can't find a solution to this very soon, I'm either scrapping maven for some hacked Gradle implementation (though I can't use that either), or I'm moving over to NetBeans, which is not a winning proposition.
As requested, the pom snippet is below.
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>src/main/groovy</source>
</sources>
</configuration>
</execution>
<execution>
<id>add-test-source</id>
<phase>generate-test-sources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>src/test/groovy</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<compilerId>groovy-eclipse-compiler</compilerId>
<verbose>true</verbose>
<source>1.6</source>
<target>1.6</target>
</configuration>
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-batch</artifactId>
<version>1.8.0-03</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-compiler</artifactId>
<version>2.5.1</version>
<exclusions>
<exclusion>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-batch</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<versionRange>[2.3.1,)</versionRange>
<goals>
<goal>testCompile</goal>
<goal>compile</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute />
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-compiler</artifactId>
<versionRange>[2.5.1,)</versionRange>
<goals>
<goal>testCompile</goal>
<goal>compile</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>

First, you must install the correct configurator. I am assuming that you are using m2e version 1.0. If that is the case, then you must install the newer version of the Groovy-Eclipse configurator for m2e. At this update site:
http://dist.codehaus.org/groovy/distributions/greclipse/snapshot/e3.6/
(do not use the groovy-m2eclipse-new update site. It is outdated and will go away soon.)
I haven't done extensive testing for the configurator on Eclipse 3.6, but it should work. I do recommend that you upgrade to Eclipse Indigo because things will generally work better on Indigo.
Second, you need to fix your pom.xml. Remove the reference to the org.eclipse.m2e plugin.

Take a look at the following link I posted in groovy user group. Note, I used spring STS which is just a better eclipse. I am also pasting my pom for a test suite for your reference, please note the sourceincludes element carefully. I was also at my wits end trying to fix this, but it definitely works now. Also, please make sure that the maven in eclipse points to the same one you installed in your machine otherwise it can also cause issues.
[Update] Also install either of the following plugins depending on your eclipse version to provide Groovy - Maven integration
http://dist.codehaus.org/groovy/distributions/greclipse/groovy-m2eclipse-new/ or
http://dist.codehaus.org/groovy/distributions/greclipse/groovy-m2eclipse/
<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.example.org</groupId>
<artifactId>test-suite</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>test-suite</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>jetlang.googlecode.com</id>
<name>Jetlang Repository for Maven</name>
<url>http://jetlang.googlecode.com/svn/repo/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.1.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-core</artifactId>
<version>2.0.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-support</artifactId>
<version>2.0.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>3.0.5.RELEASE</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jetlang</groupId>
<artifactId>jetlang</artifactId>
<version>0.2.5</version>
</dependency>
<!-- Database pool -->
<dependency>
<groupId>c3p0</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.1.2</version>
</dependency>
<!-- ORACLE database driver -->
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc5</artifactId>
<version>11.2.0.1.0</version>
</dependency>
<dependency>
<groupId>jdom</groupId>
<artifactId>jdom</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>jaxen</groupId>
<artifactId>jaxen</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>xalan</groupId>
<artifactId>xalan</artifactId>
<version>2.7.1</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
</dependency>
<!-- Groovy jar -->
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy</artifactId>
<version>1.8.0</version>
<type>jar</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<compilerId>groovy-eclipse-compiler</compilerId>
<compilerArgument>nowarn</compilerArgument>
<!--<verbose>true</verbose> -->
</configuration>
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-compiler</artifactId>
<version>2.5.1-1</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-batch</artifactId>
<version>1.8.0-03</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.8</version>
<configuration>
<additionalProjectnatures>
<projectnature>org.eclipse.jdt.groovy.core.groovyNature</projectnature>
</additionalProjectnatures>
<sourceIncludes>
<sourceInclude>**/*.groovy</sourceInclude>
</sourceIncludes>
</configuration>
</plugin>
</plugins>
</build>

Related

Unable to see libraries downloaded from mvn in packaged JAR

This is my pom.xml:
<?xml version='1.0' encoding='UTF-8'?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<groupId>default</groupId>
<artifactId>factory-servicing</artifactId>
<packaging>jar</packaging>
<description>factory-servicing</description>
<version>0.1</version>
<name>factory-servicing</name>
<organization>
<name>default</name>
</organization>
<dependencies>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.12</artifactId>
<version>3.1.2</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_2.12</artifactId>
<version>3.1.2</version>
</dependency>
<dependency>
<groupId>com.ibm.db2.jcc</groupId>
<artifactId>db2jcc</artifactId>
<version>db2jcc4</version>
</dependency>
<dependency>
<groupId>org.scalikejdbc</groupId>
<artifactId>scalikejdbc_2.12</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>com.typesafe</groupId>
<artifactId>config</artifactId>
<version>1.4.2</version>
</dependency>
<dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest_2.12</artifactId>
<version>3.0.8</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.specs2</groupId>
<artifactId>specs2-core_${scala.compat.version}</artifactId>
<version>${spec2.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.specs2</groupId>
<artifactId>specs2-junit_${scala.compat.version}</artifactId>
<version>${spec2.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/main/scala</sourceDirectory>
<testSourceDirectory>src/test/scala</testSourceDirectory>
<plugins>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>3.3.2</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
<configuration>
<args>
<arg>-dependencyfile</arg>
<arg>${project.build.directory}/.scala_dependencies</arg>
</args>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.21.0</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
<plugin>
<groupId>org.scalatest</groupId>
<artifactId>scalatest-maven-plugin</artifactId>
<version>2.0.0</version>
<configuration>
<reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
<junitxml>.</junitxml>
<filereports>TestSuiteReport.txt</filereports>
</configuration>
<executions>
<execution>
<id>test</id>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>uber-jar</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_${scala.dep.version}</artifactId>
<version>${spark.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_${scala.dep.version}</artifactId>
<version>${spark.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.ibm.db2.jcc</groupId>
<artifactId>db2jcc</artifactId>
<version>db2jcc4</version>
</dependency>
<dependency>
<groupId>org.scalikejdbc</groupId>
<artifactId>scalikejdbc_2.12</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>com.typesafe</groupId>
<artifactId>config</artifactId>
<version>1.4.2</version>
</dependency>
</dependencies>
</profile>
</profiles>
</project>
As you can see, for the outer dependencies stage, I don't have anything scoped to provided. This is because I need all libraries to run my test cases.
However, for the package stage's dependencies, which uses the maven-shade-plugin, I'm providing the spark dependencies as provided, whereas the rest of the libraries from the outer dependencies remain unchanged. This is because for Spark we will be providing the JARs, but for the rest we still need it in the packaged jar.
Then when I run mvn package, it generates a JAR file, which I go on to extract. However, on extracting the JAR file, I only see the class files that I had written in my project, and I don't see any of the other libraries that are not scoped to provided.
How do I ensure that the non-provided libraries are also included as a part of the mvn package command execution?

How to generate source code from avro schema in maven(eclipse)?

I know this is not the first time this question has been asked. As i have gone through several links, but unable to understand why avro schema is not generating the source code when no error is being thrown in maven(eclipse). I have tried deleting 'pluginManagement' from pom.xml file but it throws error.
Tried deleting .m2 repo,mvn clean, mvn install, nothing seems to work. Not sure what is the issue.
Also, could you please tell me how to add 'fieldVisibility=private' argument while generating the source code from the command line.
Please guide! Thank you!
This is the pom.xml file
http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
<groupId>kafka</groupId>
<artifactId>ProducerConsumer</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>ProducerConsumer</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>io.confluent</groupId>
<artifactId>kafka-avro-serializer</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.avro</groupId>
<artifactId>avro</artifactId>
<version>1.8.2</version>
</dependency>
<dependency>
<groupId>org.apache.avro</groupId>
<artifactId>avro-tools</artifactId>
<version>1.8.2</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.19</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.1.6</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.11.2</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.11.2</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>confluent</id>
<url>http://packages.confluent.io/maven/</url>
</repository>
</repositories>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.avro</groupId>
<artifactId>avro</artifactId>
<version>1.9.2</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>schema</goal>
</goals>
<configuration>
<sourceDirectory>${project.basedir}/src/main/avro/</sourceDirectory>
<outputDirectory>${project.basedir}/src/main/java/</outputDirectory>
<fieldVisibility>PRIVATE</fieldVisibility>
<includes>
<include>**/*.avro</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
I would suggest to use the correct setup like this:
There are two things: you are using not the avro-maven-plugin and also you have configured it in the pluginManagement instead of in using correctly located in <build><plugins>...</plugins></build>.
<project..>
<build>
<plugins>
<plugin>
<groupId>org.apache.avro</groupId>
<artifactId>avro-maven-plugin</artifactId>
<version>1.9.2</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>schema</goal>
</goals>
<configuration>
<sourceDirectory>${project.basedir}/src/main/avro/</sourceDirectory>
<outputDirectory>${project.basedir}/src/main/java/</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

java.lang.NoClassDefFoundError: org/apache/spark/internal/Logging

My Spark Streaming program received the following error:
Exception in thread "main" java.lang.NoClassDefFoundError:org/apache/spark/internal/Logging
My version of spark is 2.1, which is the same as the version running in the cluster.
The information I found on the Internet prompted me that the old version of org.apache.spark.Logging became org.apache.spark.internal.Logging in the new version, which prevented the jar package from being found. But the dependency introduced in my pom is a new version. Why can't I find the jar package?
<properties>
<spark.version>2.1.0</spark.version>
<scala.version>2.11</scala.version>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_${scala.version}</artifactId>
<version>${spark.version}</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-streaming_${scala.version}</artifactId>
<version>${spark.version}</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_${scala.version}</artifactId>
<version>${spark.version}</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-hive_${scala.version}</artifactId>
<version>${spark.version}</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-streaming-kafka-0-10_2.11</artifactId>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-client</artifactId>
<version>2.6.0</version>
</dependency>
<dependency>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<version>2.15.2</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<version>2.15.2</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
I have encountered java.lang.NoClassDefFoundError several times.I have Spark-2.3.1 installed so I think it should work in your case too.
In my case, java.lang.NoClassDefFoundError:org/apache/spark/internal/Logging should come from spark-core_2.11-2.3.1.jar and in your case, it should be coming from spark-core_2.11-2.1.0.jar based on your spark and scala version mentioned in the question
When you look at the source code, it is using org.slf4j._ classes. So my recommendation would be to add this dependency in your pom and then try.
For NoClassDefFoundError, it is always better to find the jar which is generating this error and then try to backtrack it.
Below is how you can find out which jar is causing the NoClassDefFound error, assuming you have all the dependency jars in ~/spark/jars location.
for i in `ls ~/spark/jars/*.jar`;
do
jar tvf $i | grep org/apache/spark/internal/Logging;
echo "************** $i ************** ";
done
Please let me know if this solved your issue.

Maven does not include the web content anymore after converting Dynamic Web Project

I created a dynamic web application then converted it to maven project.
When I try to deploy it using with maven build, It creates the war file and others(META-INF, WEB-INF) but Maven doesn't deploy the xhtml files and the web.xml file which are under the WEB-INF folder.
I can manually copy the xhtml files to target(tomcat/webapps) and it works.. but when i copy the web.xml file manually, the web application crashes.
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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>my_group_ıd</groupId>
<artifactId>my_artifact_id</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>My_Webapp_name</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<!-- Servlet -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
</dependency>
<!-- Faces Implementation -->
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.2.4</version>
</dependency>
<!-- Faces Library -->
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.2.4</version>
</dependency>
<!-- Primefaces Version 5 -->
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>5.1</version>
</dependency>
<!-- JSP Library -->
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
<version>2.3.1</version>
</dependency>
<!-- JSTL Library -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.23</version>
</dependency>
<dependency>
<groupId>com.lowagie</groupId>
<artifactId>itext</artifactId>
<version>2.1.7</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.7</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-el</artifactId>
<version>7.0.63</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
<version>8.0.24</version>
<scope>provided</scope>
</dependency>
</dependencies>
<repositories>
<repository>
<id>prime-repo</id>
<name>Prime Repo</name>
<url>http://repository.primefaces.org</url>
</repository>
</repositories>
<build>
<finalName>my_final_name</finalName>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<url>http://localhost:8080/manager/text</url>
<server>TomcatServer</server>
<username>username</username>
<password>password</password>
<path>/my_path</path>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<warSourceDirectory>webapp</warSourceDirectory>
</configuration>
<executions>
<execution>
<id>default-war</id>
<phase>package</phase>
<goals>
<goal>war</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
I have tried many things to deploy them automatically with maven. I couldn't be successful, so far..
I removed this plugin and changed various things in web.xml.. it works
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<warSourceDirectory>webapp</warSourceDirectory>
</configuration>
<executions>
<execution>
<id>default-war</id>
<phase>package</phase>
<goals>
<goal>war</goal>
</goals>
</execution>
</executions>
</plugin>
thanks everyone
I have converted web application to maven and added your plugin but jars are added into target folders web-inf/jars folder not in web-content folder.

GWTP Boilerplate Generation with Maven - build success inconsistency

I'm fairly new to Maven, but I'm using it because that's what the GWTP plugin gives when you create a new project. I have a few DTOs I'm creating using the #GenDto annotation. The following is my pom.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.test</groupId>
<artifactId>MyProject</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>MyProject</name>
<properties>
<!-- client -->
<gwt.version>2.7.0</gwt.version>
<gwtp.version>1.5</gwtp.version>
<gin.version>2.1.2</gin.version>
<!-- server -->
<guice.version>3.0</guice.version>
<resteasy.version>3.0.13.Final</resteasy.version>
<jbcrypt.version>0.3m</jbcrypt.version>
<jax-rs.version>1.1.1</jax-rs.version>
<arcbees.version>1.2</arcbees.version>
<!-- testing -->
<junit.version>4.12</junit.version>
<jukito.version>1.4.1</jukito.version>
<!-- maven -->
<gwt-maven-plugin.version>2.7.0</gwt-maven-plugin.version>
<maven-surefire-plugin.version>2.17</maven-surefire-plugin.version>
<maven-compiler-plugin.version>3.2</maven-compiler-plugin.version>
<maven-war-plugin.version>2.5</maven-war-plugin.version>
<maven-resources-plugin.version>2.5</maven-resources-plugin.version>
<maven-processor-plugin.version>2.0.5</maven-processor-plugin.version>
<maven-build-helper-plugin.version>1.7</maven-build-helper-plugin.version>
<target.jdk>1.7</target.jdk>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
</properties>
<build>
<outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.bsc.maven</groupId>
<artifactId>maven-processor-plugin</artifactId>
<version>2.2.4</version>
<executions>
<execution>
<id>process</id>
<goals>
<goal>process</goal>
</goals>
<phase>generate-sources</phase>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.gwtplatform</groupId>
<artifactId>gwtp-processors</artifactId>
<version>${gwtp.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${project.build.directory}/generated-sources</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>${target.jdk}</source>
<target>${target.jdk}</target>
<encoding>${project.build.sourceEncoding}</encoding>
<compilerArgument>-proc:none</compilerArgument>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>${maven-war-plugin.version}</version>
<configuration>
<archiveClasses>true</archiveClasses>
</configuration>
</plugin>
<!-- JUnit Testing - skip *.GwtTest cases -->
<!-- 'mvn test' - runs the Jukito tests -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<includes>
<include>**/*Test.java</include>
</includes>
<excludes>
<exclude>**/*GwtTest.java</exclude>
</excludes>
</configuration>
</plugin>
<!-- GWT -->
<!-- 'mvn gwt:run' - runs development mode -->
<!-- 'mvn gwt:debug' - runs debug mode -->
<!-- 'mvn gwt:compile' - compiles gwt -->
<!-- 'mvn integration-test' - runs the gwt tests (*GwtTest.java) -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>${gwt-maven-plugin.version}</version>
<configuration>
<!-- With multiple tests use GwtTestSuite.java for speed -->
<includes>**/*GwtTest.java</includes>
<bindAddress>0.0.0.0</bindAddress>
<extraJvmArgs>-Xss1024K -Xmx1024M -XX:MaxPermSize=256M</extraJvmArgs>
<logLevel>TRACE</logLevel>
<copyWebapp>true</copyWebapp>
<hostedWebapp>${webappDirectory}</hostedWebapp>
<runTarget>MyProject.jsp</runTarget>
<modules>
<module>com.test.MyProject</module>
</modules>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
<!-- Google Web Toolkit -->
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwt.version}</version>
</dependency>
<!-- GWT-Platform -->
<dependency>
<groupId>com.gwtplatform</groupId>
<artifactId>gwtp-mvp-client</artifactId>
<version>${gwtp.version}</version>
</dependency>
<dependency>
<groupId>com.gwtplatform</groupId>
<artifactId>gwtp-dispatch-rpc-client</artifactId>
<version>${gwtp.version}</version>
</dependency>
<dependency>
<groupId>com.gwtplatform</groupId>
<artifactId>gwtp-dispatch-rpc-server-guice</artifactId>
<version>${gwtp.version}</version>
</dependency>
<dependency>
<groupId>com.gwtplatform</groupId>
<artifactId>gwtp-dispatch-rpc-shared</artifactId>
<version>${gwtp.version}</version>
</dependency>
<dependency>
<groupId>com.gwtplatform</groupId>
<artifactId>gwtp-dispatch-rest</artifactId>
<version>${gwtp.version}</version>
</dependency>
<dependency>
<groupId>com.gwtplatform.extensions</groupId>
<artifactId>dispatch-rest-delegates</artifactId>
<version>${gwtp.version}</version>
</dependency>
<dependency>
<groupId>com.gwtplatform</groupId>
<artifactId>gwtp-dispatch-rest-shared</artifactId>
<version>${gwtp.version}</version>
</dependency>
<dependency>
<groupId>com.gwtplatform</groupId>
<artifactId>gwtp-processors</artifactId>
<version>${gwtp.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>5.0.2.Final</version>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<version>10.12.1.1</version>
</dependency>
<!-- DI -->
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>${guice.version}</version>
</dependency>
<dependency>
<groupId>com.google.inject.extensions</groupId>
<artifactId>guice-servlet</artifactId>
<version>${guice.version}</version>
</dependency>
<dependency>
<groupId>com.google.inject.extensions</groupId>
<artifactId>guice-assistedinject</artifactId>
<version>${guice.version}</version>
</dependency>
<dependency>
<groupId>com.google.inject.extensions</groupId>
<artifactId>guice-persist</artifactId>
<version>${guice.version}</version>
</dependency>
<dependency>
<groupId>com.google.gwt.inject</groupId>
<artifactId>gin</artifactId>
<version>${gin.version}</version>
</dependency>
<dependency>
<groupId>org.mindrot</groupId>
<artifactId>jbcrypt</artifactId>
<version>${jbcrypt.version}</version>
</dependency>
<dependency>
<groupId>com.arcbees</groupId>
<artifactId>guicy-resteasy</artifactId>
<version>${arcbees.version}</version>
</dependency>
<!-- REST -->
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<version>${resteasy.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jackson2-provider</artifactId>
<version>${resteasy.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-guice</artifactId>
<version>${resteasy.version}</version>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
<version>${jax-rs.version}</version>
<!-- Provided because RestEasy has its own implementation -->
<scope>provided</scope>
</dependency>
<!-- Test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jukito</groupId>
<artifactId>jukito</artifactId>
<version>${jukito.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
It works just fine if I do a Maven build with the goals clean gwt:run, but then any subsequent builds with only the goal gwt:run will error, saying duplicate class: com.test.shared.dto.LoginDto.
If I follow the suggestion here to add <compilerArgument>-proc:none</compilerArgument>, then the subsequent builds work. However, with the original clean gwt:run goals, it'll fail, saying cannot find symbol: class LoginDto.
Is there any way to make it so that the two builds are consistent?
This is a bug of the maven-compiler-plugin 3.2 (and 3.1 IIRC). Downgrade to 3.0, and add the build-helper-maven-compiler to add the generated source folder as a source folder in the process-classes phase (important is "after compile phase").