“重复类”使用maven的代码生成(GWTP) [英] "duplicate class" on boilerplate generation (GWTP) with maven
问题描述
使用GWTP的样板机制后,我收到了类(其中生成的哪些)已经存在的错误。目标/生成源文件夹包含注释和apt,但没有gwt。两个文件夹注释和apt都有相同的内容。
我的pom.xml:
<?xml version =1.0encoding =UTF-8?>
< project xmlns =http://maven.apache.org/POM/4.0.0xmlns: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> de.s.pp< / groupId>
< artifactId> projectplanning< / artifactId>
< version> 1.0-SNAPSHOT< / version>
< packaging> war< / packaging>
< name> Projekt Planung< / name>
< description>基本GWTP应用< / description>
< properties>
<! - client - >
< gwt.version> 2.7.0< / gwt.version>
< gwtp.version> 1.4< / gwtp.version>
< gin.version> 2.1.2< /gin.version>
<! - 服务器 - >
< guice.version> 3.0< /guice.version>
<! - 测试 - >
< junit.version> 4.11< / junit.version>
< jukito.version> 1.1< / jukito.version>
<! - maven - >
< gwt-maven-plugin.version> 2.7.0< / gwt-maven-plugin.version>
< maven-surefire-plugin.version> 2.18.1< /maven-surefire-plugin.version>
< maven-compiler-plugin.version> 3.2< /maven-compiler-plugin.version>
< maven-resources-plugin.version> 2.7< /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>
< source.jdk> 1.6< /source.jdk>
< target.jdk> 1.6< /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>
< resources>
< resource>
< directory> src / main / resources< / directory>
< / resource>
< resource>
< directory> $ {project.build.directory} / generated-sources / apt< / directory>
< / resource>
< resource>
< directory> $ {project.build.directory} / generated-sources / gwt< / directory>
< / resource>
< / resources>
< plugins>
<! - 在src / home / java源上运行注释处理器 - >
< plugin>
< groupId> org.bsc.maven< / groupId>
< artifactId> maven-processor-plugin< / artifactId>
< version> 2.2.4< / version>
<执行>
< execution>
< id>进程< / id>
< goals>
< goal>进程< / goal>
< / goals>
< phase> generate-sources< / phase>
< / execution>
< / executions>
<依赖关系>
<依赖关系>
< 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>
<执行>
< execution>
< id> add-source< / id>
< phase> generate-sources< / phase>
< goals>
< goal> add-source< / goal>
< / goals>
< configuration>
< sources>
< source> $ {project.build.directory} / generated-sources / apt< / source>
< source> $ {project.build.directory} / generated-sources / gwt< / 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> $ {source.jdk}< / source>
< target> $ {target.jdk}< / target>
< encoding> $ {project.build.sourceEncoding}< / encoding>
< / configuration>
< / plugin>
< plugin>
< groupId> org.apache.tomcat.maven< / groupId>
< artifactId> tomcat7-maven-plugin< / artifactId>
< version> 2.1< / version>
< / plugin>
<! - JUnit测试 - 跳过* .GwtTest个案 - >
<! - 'mvn test' - 运行Jukito测试 - >
< 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' - 运行开发模式 - >
<! - 'mvn gwt:debug' - 运行调试模式 - >
<! - 'mvn gwt:compile' - 编译gwt - >
<! - 'mvn integration-test' - 运行gwt测试(* GwtTest.java) - >
< plugin>
< groupId> org.codehaus.mojo< / groupId>
< artifactId> gwt-maven-plugin< / artifactId>
< version> $ {gwt.version}< / version>
< configuration>
<! - 通过多次测试,使用GwtTestSuite.java进行速度 - >
< includes> ** / * GwtTest.java< / includes>
< extraJvmArgs> -Xss1024K -Xmx1024M -XX:MaxPermSize = 256M< / extraJvmArgs>
< copyWebapp> true< / copyWebapp>
< hostedWebapp> $ {webappDirectory}< / hostedWebapp>
<! - < logLevel> DEBUG< / logLevel> - >
< runTarget> index.html< / runTarget>
< modules>
< module> de.s.pp.projectplanning< / module>
< / modules>
< / configuration>
<执行>
< execution>
< id> compileAndTest< / id>
< goals>
< goal> compile< / goal>
< goal> test< / goal>
< / goals>
< / execution>
< execution>
< id> packageGeneration< / id>
< phase> prepare-package< / phase>
< goals>
< goal> compile< / goal>
< / goals>
< / execution>
< / executions>
< / plugin>
< plugin>
< groupId> org.datanucleus< / groupId>
< artifactId> datanucleus-maven-plugin< / artifactId>
< version> 3.2.0-release< / version>
< configuration>
< fork> false< / fork>
< api> JDO< / api>
<! - < ddlFile> $ {basedir} /servicecenter.ddl</ddlFile> - >
< props> $ {basedir} /datanucleus.properties</props>
< log4jConfiguration> $ {basedir} /log4j.properties</log4jConfiguration>
< verbose> true< / verbose>
< / configuration>
<执行>
< execution>
< phase> process-classes< / phase>
< goals>
< goal>增强< / goal>
< / goals>
< / execution>
< / executions>
< / plugin>
< / plugins>
< pluginManagement>
< plugins>
<! - 此插件的配置用于仅存储Eclipse m2e设置
。它对Maven构建本身没有影响。 - >
< plugin>
< groupId> org.eclipse.m2e< / groupId>
< artifactId>生命周期映射< / artifactId>
< version> 1.0.0< / version>
< configuration>
< lifecycleMappingMetadata>
< pluginExecutions>
< pluginExecution>
< pluginExecutionFilter>
< groupId>
org.datanucleus
< / groupId>
< artifactId>
datanucleus-maven-plugin
< / artifactId>
< versionRange>
[3.2.0-release]
< / versionRange>
< goals>
< goal>增强< / goal>
< / goals>
< / pluginExecutionFilter>
< action>
< ignore>< / ignore>
< / action>
< / pluginExecution>
< pluginExecution>
< pluginExecutionFilter>
< groupId> org.bsc.maven< / groupId>
< artifactId>
maven-processor-plugin
< / artifactId>
< versionRange>
[2.2.4,]
< / versionRange>
< goals>
< goal>进程< / goal>
< / goals>
< / pluginExecutionFilter>
< action>
< ignore>< / ignore>
< / action>
< / pluginExecution>
< pluginExecution>
< pluginExecutionFilter>
< groupId> org.bsc.maven< / groupId>
< artifactId> maven-processor-plugin< / artifactId>
< versionRange> [2.2.4,)< / versionRange>
< goals>
< goal> generate-sources< / goal>
< / goals>
< / pluginExecutionFilter>
< action>
< execute />
< / action>
< / pluginExecution>
< pluginExecution>
< pluginExecutionFilter>
< groupId>
org.codehaus.mojo
< / groupId>
< artifactId>
build-helper-maven-plugin
< / artifactId>
< versionRange>
[1.5,)
< / versionRange>
< goals>
< goal> add-source< / goal>
< / goals>
< / pluginExecutionFilter>
< action>
< ignore>< / ignore>
< / action>
< / pluginExecution>
< / pluginExecutions>
< / lifecycleMappingMetadata>
< / configuration>
< / plugin>
< / plugins>
< / pluginManagement>
< / build>
<依赖关系>
<! - Google Web Toolkit - >
<依赖关系>
< groupId> com.google.gwt< / groupId>
< artifactId> gwt-user< / artifactId>
< version> $ {gwt.version}< / version>
< scope>已提供< / scope>
< / dependency>
<依赖关系>
< groupId> com.google.gwt< / groupId>
< artifactId> gwt-servlet< / artifactId>
< version> $ {gwt.version}< / version>
< scope>运行时< / scope>
< / dependency>
<! - GWT-Platform - >
<! - MVP组件 - >
<依赖关系>
< groupId> com.gwtplatform< / groupId>
< artifactId> gwtp-mvp-client< / artifactId>
< version> $ {gwtp.version}< / version>
< scope>已提供< / scope>
< / dependency>
<! - 调度组件 - >
<依赖关系>
< groupId> com.gwtplatform< / groupId>
< artifactId> gwtp-dispatch-rpc-client< / artifactId>
< version> $ {gwtp.version}< / version>
< scope>已提供< / scope>
< / dependency>
<依赖关系>
< groupId> com.gwtplatform< / groupId>
< artifactId> gwtp-dispatch-rpc-server-guice< / artifactId>
<! - 或者,如果您使用spring:< artifactId> gwtp-dispatch-server-spring< / artifactId> - >
< version> $ {gwtp.version}< / version>
< / dependency>
<! - 抓取器组件 - >
<依赖关系>
< groupId> com.gwtplatform< / groupId>
< artifactId> gwtp-crawler< / artifactId>
< version> $ {gwtp.version}< / version>
< / dependency>
<! - 注释组件 - >
<依赖关系>
< groupId> com.gwtplatform< / groupId>
< artifactId> gwtp-processors< / artifactId>
< version> $ {gwtp.version}< / version>
< scope>已提供< / scope>
< / dependency>
<! - 测试器组件 - >
<依赖关系>
< groupId> com.gwtplatform< / groupId>
< artifactId> gwtp-tester< / artifactId>
< version> $ {gwtp.version}< / version>
< scope> test< / scope>
< / dependency>
<! - DI - >
<依赖关系>
< groupId> com.google.inject< / groupId>
< artifactId> guice< / artifactId>
< version> $ {guice.version}< / version>
< / dependency>
<依赖关系>
< groupId> com.google.inject.extensions< / groupId>
< artifactId> guice-servlet< / artifactId>
< version> $ {guice.version}< / version>
< / dependency>
<依赖关系>
< groupId> com.google.inject.extensions< / groupId>
< artifactId> guice-assistedinject< / artifactId>
< version> $ {guice.version}< / version>
< / dependency>
<依赖关系>
< groupId> com.google.gwt.inject< / groupId>
< artifactId> gin< / artifactId>
< version> $ {gin.version}< / version>
< / dependency>
<! - 测试 - >
<依赖关系>
< groupId> junit< / groupId>
< artifactId> junit< / artifactId>
< version> $ {junit.version}< / version>
< scope> test< / scope>
< / dependency>
<依赖关系>
< groupId> org.jukito< / groupId>
< artifactId> jukito< / artifactId>
< version> $ {jukito.version}< / version>
< scope> test< / scope>
< / dependency>
<! - 番石榴 - >
<依赖关系>
< groupId> com.google.guava< / groupId>
< artifactId> guava< / artifactId>
< version> 16.0< / version>
< / dependency>
<依赖关系>
< groupId> com.google.guava< / groupId>
< artifactId> guava-gwt< / artifactId>
< version> 16.0< / version>
< / dependency>
<! - 数据库 - >
<依赖关系>
< groupId> org.datanucleus< / groupId>
< artifactId> datanucleus-core< / artifactId>
< version> [3.2.0,3.2.99)< / version>
< scope>运行时< / scope>
< / dependency>
<依赖关系>
< groupId> javax.jdo< / groupId>
< artifactId> jdo-api< / artifactId>
< version> 3.0.1< / version>
< / dependency>
<依赖关系>
< groupId> org.datanucleus< / groupId>
< artifactId> datanucleus-api-jdo< / artifactId>
< version> [3.2.0,3.2.99)< / version>
< / dependency>
<依赖关系>
< groupId> org.datanucleus< / groupId>
< artifactId> datanucleus-rdbms< / artifactId>
< version> [3.2.0,3.2.99)< / version>
< scope>运行时< / scope>
< / dependency>
<依赖关系>
< groupId> org.hsqldb< / groupId>
< artifactId> hsqldb< / artifactId>
< version> 2.2.9< / version>
< / dependency>
<依赖关系>
< groupId> org.mindrot< / groupId>
< artifactId> jbcrypt< / artifactId>
< version> 0.3m< / version>
< / dependency>
<依赖关系>
< groupId> javax.servlet< / groupId>
< artifactId> javax.servlet-api< / artifactId>
< version> 3.1.0< / version>
< scope>已提供< / scope>
< / dependency>
<依赖关系>
< groupId> org.apache.poi< / groupId>
< artifactId> poi< / artifactId>
< version> 3.11< / version>
< / dependency>
<依赖关系>
< groupId> org.apache.shiro< / groupId>
< artifactId> shiro-core< / artifactId>
< version> 1.2.2< / version>
< / dependency>
<依赖关系>
< groupId> org.apache.shiro< / groupId>
< artifactId> shiro-guice< / artifactId>
< version> 1.2.2< / version>
< / dependency>
<依赖关系>
< groupId> org.apache.shiro< / groupId>
< artifactId> shiro-web< / artifactId>
< version> 1.2.2< / version>
< / dependency>
<依赖关系>
< groupId> org.apache.poi< / groupId>
< artifactId> poi-ooxml< / artifactId>
< version> 3.10-beta1< / version>
< / dependency>
< / dependencies>
< repositories>
< repository>
< id> maven-restlet< / id>
< name>公共在线Restlet存储库< / name>
< url> http://maven.restlet.org< / url>
< / repository>
< repository>
< id> mvnrepository< / id>
< name>公共在线Restlet存储库< / name>
< url> http://mvnrepository.com/artifact< / url>
< / repository>
< / repositories>
< / project>
输出:
[INFO]扫描项目...
[INFO]
[INFO]使用构建器org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder与线程计数1
[INFO]
[INFO] --------------------------------- ---------------------------------------
[INFO] Building Projekt Planung 1.0 -SNAPSHOT
[INFO] ----------------------------------------- -------------------------------
[INFO]
[INFO]>>> ; gwt-maven-plugin:2.7.0:run(default-cli)@ projectplanning>>>
[INFO]
[INFO] --- maven-processor-plugin:2.2.4:process(process)@ projectplanning ---
[WARNING]没有指定处理器。使用默认发现机制。
[INFO]
[INFO] --- build-helper-maven-plugin:1.5:add-source(add-source)@ projectplanning ---
[INFO]源目录: C:\Workspaces\s\projectplanning\target\generated-sources\apt已添加。
[INFO]源目录:C:\Workspaces\s\projectplanning\target\generated-sources\gwt添加。
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources(default-resources)@ projectplanning ---
[INFO]使用'UTF-8'复制过滤的资源。
[INFO]复制57资源
[INFO]复制2资源
[INFO]跳过不存在的resourceDirectory C:\Workspaces\s\projectplanning\target\generated-sources \gwt
[INFO]
[INFO] --- maven-compiler-plugin:3.2:compile(default-compile)@ projectplanning ---
[INFO]检测到更改 - 重新编译模块!
[INFO]将187个源文件编译到C:\Workspaces\s\projectplanning\target\projectplanning-1.0-SNAPSHOT\WEB-INF\classes
[INFO] / C :/Workspaces/s/projectplanning/src/main/java/de/s/pp/server/security/UserPermissionActionValidator.java:C:\Workspaces\s\projectplanning\src\main\java\ de\s\pp\server\security\UserPermissionActionValidator.java使用未选中或不安全的操作。
[INFO] /C:/Workspaces/s/projectplanning/src/main/java/de/s/pp/server/security/UserPermissionActionValidator.java:使用-Xlint重新编译:取消选中详细信息。
[INFO] ------------------------------------------- ------------------
[错误]编译错误:
[INFO] --------------- ----------------------------------------------
[ERROR] /C:/Workspaces/s/projectplanning/target/generated-sources/apt/de/s/pp/shared/dispatch/actionresult/GetAllClustersResult.java:[7,8]重复类:de.s.pp .shared.dispatch.actionresult.GetAllClustersResult
[ERROR] /C:/Workspaces/s/projectplanning/target/generated-sources/annotations/de/s/pp/shared/dispatch/actionresult/GetAllClustersAction.java:[ 5,8]重复类:de.s.pp.shared.dispatch.actionresult.GetAllClustersAction
[INFO] 2个错误
[INFO] -------------- -----------------------------------------------
[INFO] ---------------------------------------------- --------------------------
[INFO] BUILD FAILURE
[INFO] -------- -------------------------------------------------- --------------
[INFO]总时间:6.458 s
[INFO]完成于:2015-01-20T18:11:43 + 01: 00
[INFO] Final Memory:30M / 277M
[INFO] ----------------------------- -------------------------------------------
[错误]无法执行目标org.apache.maven.plugins:maven-compiler-plugin:3.2:在项目项目计划中编译(default-compile):编译失败:编译失败:
[ERROR] / C:/ Workspaces / s /projectplanning/target/generated-sources/apt/de/s/pp/shared/dispatch/actionresult/GetAllClustersResult.java:[7,8]重复类:de.s.pp.shared.dispatch.actionresult.GetAllClustersResult
[ERROR] /C:/Workspaces/s/projectplanning/target/generated-sources/annotations/de/s/pp/shared/dispatch/actionresult/GetAllClustersAction.java:[5,8]重复类:de.s .pp.shared.dispatch.actionresult.GetAllClustersAction
[ERROR] - > [帮助1]
[ERROR]
[ERROR]要查看错误的完整堆栈跟踪,请使用-e开关重新运行Maven。
[ERROR]使用-X开关重新运行Maven以启用完整的调试日志记录。
[ERROR]
[ERROR]有关错误和可能的解决方案的更多信息,请阅读以下文章:
[错误] [帮助1] http://cwiki.apache.org / confluence / display / MAVEN / MojoFailureException
问题是maven-processor-plugin和maven-compiler-plugin在其中生成(相同)源到不同的文件夹。解决方案是禁用一个处理器。我决定禁用maven-processor-plugin。
另一个选项是添加< compilerArgument> -proc:none< / compilerArgument>
到maven-compiler-plugin。这有利于 mvn生成源
正在工作。
After using the boilerplate mechanisms of GWTP I get the error that the classes (which where generated) are already existing.
The folder target/generated-sources contains "annotations" and "apt" but no "gwt". Both folders "annotations" and "apt" have the same content.
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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.s.pp</groupId>
<artifactId>projectplanning</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>Projekt Planung</name>
<description>Basic GWTP application</description>
<properties>
<!-- client -->
<gwt.version>2.7.0</gwt.version>
<gwtp.version>1.4</gwtp.version>
<gin.version>2.1.2</gin.version>
<!-- server -->
<guice.version>3.0</guice.version>
<!-- testing -->
<junit.version>4.11</junit.version>
<jukito.version>1.1</jukito.version>
<!-- maven -->
<gwt-maven-plugin.version>2.7.0</gwt-maven-plugin.version>
<maven-surefire-plugin.version>2.18.1</maven-surefire-plugin.version>
<maven-compiler-plugin.version>3.2</maven-compiler-plugin.version>
<maven-resources-plugin.version>2.7</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>
<source.jdk>1.6</source.jdk>
<target.jdk>1.6</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>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
<resource>
<directory>${project.build.directory}/generated-sources/apt</directory>
</resource>
<resource>
<directory>${project.build.directory}/generated-sources/gwt</directory>
</resource>
</resources>
<plugins>
<!-- Run annotation processors on src/home/java sources -->
<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>
<!-- Copy the generated classses -->
<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/apt</source>
<source>${project.build.directory}/generated-sources/gwt</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>${source.jdk}</source>
<target>${target.jdk}</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.1</version>
</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.version}</version>
<configuration>
<!-- With multiple tests use GwtTestSuite.java for speed -->
<includes>**/*GwtTest.java</includes>
<extraJvmArgs>-Xss1024K -Xmx1024M -XX:MaxPermSize=256M</extraJvmArgs>
<copyWebapp>true</copyWebapp>
<hostedWebapp>${webappDirectory}</hostedWebapp>
<!-- <logLevel>DEBUG</logLevel> -->
<runTarget>index.html</runTarget>
<modules>
<module>de.s.pp.projectplanning</module>
</modules>
</configuration>
<executions>
<execution>
<id>compileAndTest</id>
<goals>
<goal>compile</goal>
<goal>test</goal>
</goals>
</execution>
<execution>
<id>packageGeneration</id>
<phase>prepare-package</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-maven-plugin</artifactId>
<version>3.2.0-release</version>
<configuration>
<fork>false</fork>
<api>JDO</api>
<!-- <ddlFile>${basedir}/servicecenter.ddl</ddlFile> -->
<props>${basedir}/datanucleus.properties</props>
<log4jConfiguration>${basedir}/log4j.properties</log4jConfiguration>
<verbose>true</verbose>
</configuration>
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>enhance</goal>
</goals>
</execution>
</executions>
</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.datanucleus
</groupId>
<artifactId>
datanucleus-maven-plugin
</artifactId>
<versionRange>
[3.2.0-release]
</versionRange>
<goals>
<goal>enhance</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.bsc.maven</groupId>
<artifactId>
maven-processor-plugin
</artifactId>
<versionRange>
[2.2.4,)
</versionRange>
<goals>
<goal>process</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.bsc.maven</groupId>
<artifactId>maven-processor-plugin</artifactId>
<versionRange>[2.2.4,)</versionRange>
<goals>
<goal>generate-sources</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute />
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.codehaus.mojo
</groupId>
<artifactId>
build-helper-maven-plugin
</artifactId>
<versionRange>
[1.5,)
</versionRange>
<goals>
<goal>add-source</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
<!-- Google Web Toolkit -->
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwt.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>${gwt.version}</version>
<scope>runtime</scope>
</dependency>
<!-- GWT-Platform -->
<!-- MVP component -->
<dependency>
<groupId>com.gwtplatform</groupId>
<artifactId>gwtp-mvp-client</artifactId>
<version>${gwtp.version}</version>
<scope>provided</scope>
</dependency>
<!-- Dispatch component -->
<dependency>
<groupId>com.gwtplatform</groupId>
<artifactId>gwtp-dispatch-rpc-client</artifactId>
<version>${gwtp.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.gwtplatform</groupId>
<artifactId>gwtp-dispatch-rpc-server-guice</artifactId>
<!-- Or, if you use spring: <artifactId>gwtp-dispatch-server-spring</artifactId> -->
<version>${gwtp.version}</version>
</dependency>
<!-- Crawler component -->
<dependency>
<groupId>com.gwtplatform</groupId>
<artifactId>gwtp-crawler</artifactId>
<version>${gwtp.version}</version>
</dependency>
<!-- Annotation component -->
<dependency>
<groupId>com.gwtplatform</groupId>
<artifactId>gwtp-processors</artifactId>
<version>${gwtp.version}</version>
<scope>provided</scope>
</dependency>
<!-- Tester component -->
<dependency>
<groupId>com.gwtplatform</groupId>
<artifactId>gwtp-tester</artifactId>
<version>${gwtp.version}</version>
<scope>test</scope>
</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.gwt.inject</groupId>
<artifactId>gin</artifactId>
<version>${gin.version}</version>
</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>
<!-- Guava -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>16.0</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava-gwt</artifactId>
<version>16.0</version>
</dependency>
<!-- Database -->
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-core</artifactId>
<version>[3.2.0, 3.2.99)</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>javax.jdo</groupId>
<artifactId>jdo-api</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-api-jdo</artifactId>
<version>[3.2.0, 3.2.99)</version>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-rdbms</artifactId>
<version>[3.2.0, 3.2.99)</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>2.2.9</version>
</dependency>
<dependency>
<groupId>org.mindrot</groupId>
<artifactId>jbcrypt</artifactId>
<version>0.3m</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.11</version>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-core</artifactId>
<version>1.2.2</version>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-guice</artifactId>
<version>1.2.2</version>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-web</artifactId>
<version>1.2.2</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.10-beta1</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>maven-restlet</id>
<name>Public online Restlet repository</name>
<url>http://maven.restlet.org</url>
</repository>
<repository>
<id>mvnrepository</id>
<name>Public online Restlet repository</name>
<url>http://mvnrepository.com/artifact</url>
</repository>
</repositories>
</project>
The output:
[INFO] Scanning for projects...
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Projekt Planung 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> gwt-maven-plugin:2.7.0:run (default-cli) @ projectplanning >>>
[INFO]
[INFO] --- maven-processor-plugin:2.2.4:process (process) @ projectplanning ---
[WARNING] No processors specified. Using default discovery mechanism.
[INFO]
[INFO] --- build-helper-maven-plugin:1.5:add-source (add-source) @ projectplanning ---
[INFO] Source directory: C:\Workspaces\s\projectplanning\target\generated-sources\apt added.
[INFO] Source directory: C:\Workspaces\s\projectplanning\target\generated-sources\gwt added.
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ projectplanning ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 57 resources
[INFO] Copying 2 resources
[INFO] skip non existing resourceDirectory C:\Workspaces\s\projectplanning\target\generated-sources\gwt
[INFO]
[INFO] --- maven-compiler-plugin:3.2:compile (default-compile) @ projectplanning ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 187 source files to C:\Workspaces\s\projectplanning\target\projectplanning-1.0-SNAPSHOT\WEB-INF\classes
[INFO] /C:/Workspaces/s/projectplanning/src/main/java/de/s/pp/server/security/UserPermissionActionValidator.java: C:\Workspaces\s\projectplanning\src\main\java\de\s\pp\server\security\UserPermissionActionValidator.java uses unchecked or unsafe operations.
[INFO] /C:/Workspaces/s/projectplanning/src/main/java/de/s/pp/server/security/UserPermissionActionValidator.java: Recompile with -Xlint:unchecked for details.
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /C:/Workspaces/s/projectplanning/target/generated-sources/apt/de/s/pp/shared/dispatch/actionresult/GetAllClustersResult.java:[7,8] duplicate class: de.s.pp.shared.dispatch.actionresult.GetAllClustersResult
[ERROR] /C:/Workspaces/s/projectplanning/target/generated-sources/annotations/de/s/pp/shared/dispatch/actionresult/GetAllClustersAction.java:[5,8] duplicate class: de.s.pp.shared.dispatch.actionresult.GetAllClustersAction
[INFO] 2 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.458 s
[INFO] Finished at: 2015-01-20T18:11:43+01:00
[INFO] Final Memory: 30M/277M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.2:compile (default-compile) on project projectplanning: Compilation failure: Compilation failure:
[ERROR] /C:/Workspaces/s/projectplanning/target/generated-sources/apt/de/s/pp/shared/dispatch/actionresult/GetAllClustersResult.java:[7,8] duplicate class: de.s.pp.shared.dispatch.actionresult.GetAllClustersResult
[ERROR] /C:/Workspaces/s/projectplanning/target/generated-sources/annotations/de/s/pp/shared/dispatch/actionresult/GetAllClustersAction.java:[5,8] duplicate class: de.s.pp.shared.dispatch.actionresult.GetAllClustersAction
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
The problem was that the maven-processor-plugin and the maven-compiler-plugin where generating the (same) sources to different folders. The solution is to disable one processor. I decided that the maven-processor-plugin will be disabled.
The other option is to add <compilerArgument>-proc:none</compilerArgument>
to the maven-compiler-plugin. This has the benifit that mvn generate-sources
is working.
这篇关于“重复类”使用maven的代码生成(GWTP)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!