我是来自.NET的Java世界的相对新手,所以我有时会为经验丰富的Java开发人员看似显而易见的事情而苦苦挣扎,但这个问题甚至使我的一些头发花哨的同事感到难过。
这是我的环境:
主项目使用GWT 2.4.0并自行编译和工作。我在同一个工作区中也有一个自定义数据库记录项目,它也可以构建而没有任何错误。我需要在主Web应用程序中使用自定义数据库日志记录功能,因此我使用Maven将前者添加为后者作为依赖项,这就是事情中断的地方。
重建工作区后,Eclipse在主项目的pom.xml中显示三个神秘错误:
null (org.apache.maven.plugins:maven-war-plugin:2.1.1:exploded:default:compile) pom.xml /TestApp line 67 Maven Build Problem
null (org.codehaus.mojo:gwt-maven-plugin:2.4.0:compile:default:prepare-package) pom.xml /TestApp line 44 Maven Build Problem
null (org.codehaus.mojo:gwt-maven-plugin:2.4.0:generateAsync:default:generate-sources) pom.xml /TestApp line 44 Maven Build Problem
向下滚动到我的问题的末尾以查看整个pom.xml。违规依赖项称为net.cds.cps.dao.logger
,可以在依赖项列表的底部找到。
在Eclipse中打开pom.xml时,插件<execution>
和gwt-maven-plugin
的两个maven-war-plugin
节点会突出显示。
通常的故障排除步骤(清理项目,禁用/启用Maven的工作区依赖项解析,更新项目配置)对错误没有影响。将依赖性版本从1.0.0更改为更具体的1.0.0.43或更通用的范围[1.0.0.0,1.0.1.0]也没有任何效果。
是否有人建议我如何解决此问题?
001 <?xml version="1.0" encoding="UTF-8"?>
002 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
003 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
004
005 <!-- POM file generated with GWT webAppCreator -->
006 <modelVersion>4.0.0</modelVersion>
007 <groupId>net.test.app</groupId>
008 <artifactId>TestApp</artifactId>
009 <packaging>war</packaging>
010 <version>1.0.0</version>
011 <name>Test App</name>
012
013 <properties>
014 <!-- Convenience property to set the GWT version -->
015 <gwtVersion>2.4.0</gwtVersion>
016 <!-- GWT needs at least java 1.5 -->
017 <webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
018 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
019
020 <spring.version>3.1.1.RELEASE</spring.version>
021 <final.name>TestApp</final.name>
022 </properties>
023
024 <build>
025 <resources>
026 <resource>
027 <filtering>true</filtering>
028 <directory>src/main/resources</directory>
029 </resource>
030 </resources>
031 <finalName>${final.name}</finalName>
032
033 <!-- Generate compiled stuff in the folder used for developing mode -->
034 <outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>
035
036 <plugins>
037
038 <!-- GWT Maven Plugin -->
039 <plugin>
040 <groupId>org.codehaus.mojo</groupId>
041 <artifactId>gwt-maven-plugin</artifactId>
042 <version>2.4.0</version>
043 <executions>
044 <execution>
045 <goals>
046 <goal>compile</goal>
047 <goal>i18n</goal>
048 <goal>generateAsync</goal>
049 </goals>
050 </execution>
051 </executions>
052 <!-- Plugin configuration. There are many available options, see gwt-maven-plugin
053 documentation at codehaus.org -->
054 <configuration>
055 <runTarget>Main.html</runTarget>
056 <hostedWebapp>${webappDirectory}</hostedWebapp>
057 <i18nMessagesBundle>net.cds.cps.cpcadmin.client.Messages</i18nMessagesBundle>
058 </configuration>
059 </plugin>
060
061 <!-- Copy static web files before executing gwt:run -->
062 <plugin>
063 <groupId>org.apache.maven.plugins</groupId>
064 <artifactId>maven-war-plugin</artifactId>
065 <version>2.1.1</version>
066 <executions>
067 <execution>
068 <phase>compile</phase>
069 <goals>
070 <goal>exploded</goal>
071 </goals>
072 </execution>
073 </executions>
074 <configuration>
075 <webappDirectory>
076 ${webappDirectory}
077 </webappDirectory>
078 </configuration>
079 </plugin>
080
081 <plugin>
082 <groupId>org.apache.maven.plugins</groupId>
083 <artifactId>maven-compiler-plugin</artifactId>
084 <version>2.3.2</version>
085 <configuration>
086 <source>1.6</source>
087 <target>1.6</target>
088 </configuration>
089 </plugin>
090 </plugins>
091
092 <pluginManagement>
093 <plugins>
094 <plugin>
095 <groupId>org.eclipse.m2e</groupId>
096 <artifactId>lifecycle-mapping</artifactId>
097 <version>1.0.0</version>
098 <configuration>
099 <lifecycleMappingMetadata>
100 <pluginExecutions>
101 <pluginExecution>
102 <pluginExecutionFilter>
103 <groupId>org.codehaus.mojo</groupId>
104 <artifactId>gwt-maven-plugin</artifactId>
105 <versionRange>2.4.0</versionRange>
106 <goals>
107 <goal>resources</goal>
108 <goal>compile</goal>
109 <goal>test</goal>
110 <goal>i18n</goal>
111 <goal>generateAsync</goal>
112 </goals>
113 </pluginExecutionFilter>
114 <action>
115 <execute />
116 </action>
117 </pluginExecution>
118 <pluginExecution>
119 <pluginExecutionFilter>
120 <groupId>org.apache.maven.plugins</groupId>
121 <artifactId>maven-war-plugin</artifactId>
122 <versionRange>[2.1.1,)</versionRange>
123 <goals>
124 <goal>exploded</goal>
125 </goals>
126 </pluginExecutionFilter>
127 <action>
128 <execute />
129 </action>
130 </pluginExecution>
131 </pluginExecutions>
132 </lifecycleMappingMetadata>
133 </configuration>
134 </plugin>
135 </plugins>
136 </pluginManagement>
137
138 </build>
139
140 <dependencies>
141
142 <!-- Google Web Toolkit Stuff -->
143 <dependency>
144 <groupId>com.google.gwt</groupId>
145 <artifactId>gwt-servlet</artifactId>
146 <version>${gwtVersion}</version>
147 <scope>runtime</scope>
148 </dependency>
149 <dependency>
150 <groupId>com.google.gwt</groupId>
151 <artifactId>gwt-user</artifactId>
152 <version>${gwtVersion}</version>
153 <scope>provided</scope>
154 </dependency>
155 <dependency>
156 <groupId>junit</groupId>
157 <artifactId>junit</artifactId>
158 <version>4.7</version>
159 <scope>test</scope>
160 </dependency>
161 <dependency>
162 <groupId>javax.validation</groupId>
163 <artifactId>validation-api</artifactId>
164 <version>1.0.0.GA</version>
165 <scope>test</scope>
166 </dependency>
167 <dependency>
168 <groupId>javax.validation</groupId>
169 <artifactId>validation-api</artifactId>
170 <version>1.0.0.GA</version>
171 <classifier>sources</classifier>
172 <scope>test</scope>
173 </dependency>
174
175 <!-- Spring -->
176 <dependency>
177 <groupId>org.springframework</groupId>
178 <artifactId>org.springframework.context</artifactId>
179 <version>${spring.version}</version>
180 </dependency>
181 <dependency>
182 <groupId>org.springframework</groupId>
183 <artifactId>org.springframework.core</artifactId>
184 <version>${spring.version}</version>
185 </dependency>
186 <dependency>
187 <groupId>org.springframework</groupId>
188 <artifactId>org.springframework.web</artifactId>
189 <version>${spring.version}</version>
190 </dependency>
191 <dependency>
192 <groupId>org.springframework</groupId>
193 <artifactId>org.springframework.web.servlet</artifactId>
194 <version>${spring.version}</version>
195 </dependency>
196 <dependency>
197 <groupId>org.springframework</groupId>
198 <artifactId>org.springframework.beans</artifactId>
199 <version>${spring.version}</version>
200 </dependency>
201 <dependency>
202 <groupId>org.springframework</groupId>
203 <artifactId>org.springframework.oxm</artifactId>
204 <version>${spring.version}</version>
205 </dependency>
206 <dependency>
207 <groupId>org.springframework</groupId>
208 <artifactId>spring-jdbc</artifactId>
209 <version>${spring.version}</version>
210 </dependency>
211
212 <!--db -->
213 <dependency>
214 <groupId>net.sourceforge.jtds</groupId>
215 <artifactId>jtds</artifactId>
216 <version>1.2.4</version>
217 </dependency>
218 <dependency>
219 <groupId>org.mybatis</groupId>
220 <artifactId>mybatis-spring</artifactId>
221 <version>1.0.2</version>
222 </dependency>
223 <dependency>
224 <groupId>org.springframework.data</groupId>
225 <artifactId>spring-data-commons-core</artifactId>
226 <version>1.1.0.RELEASE</version>
227 </dependency>
228 <dependency>
229 <groupId>commons-dbcp</groupId>
230 <artifactId>commons-dbcp</artifactId>
231 <version>1.2.2</version>
232 </dependency>
233
234
235 <!-- logging -->
236
237 <dependency>
238 <groupId>ant</groupId>
239 <artifactId>ant-apache-log4j</artifactId>
240 <version>1.6.5</version>
241 </dependency>
242
243 <dependency>
244 <groupId>log4j</groupId>
245 <artifactId>log4j</artifactId>
246 <version>1.2.16</version>
247 </dependency>
248
249 <dependency>
250 <groupId>net.cds.cps.dao.logger</groupId>
251 <artifactId>LoggingDAO</artifactId>
252 <version>1.0.0</version>
253 </dependency>
254 </dependencies>
255
256 <repositories>
257 <repository>
258 <id>asc.internal</id>
259 <name>Internal Repository</name>
260 <url>http://repository/maven2/internal</url>
261 </repository>
262 <repository>
263 <id>springsource-release</id>
264 <name>SpringSource Releases Repository</name>
265 <url>http://repository.springsource.com/maven/bundles/release</url>
266 </repository>
267 <repository>
268 <id>springsource-external</id>
269 <name>SpringSource External Releases Repository</name>
270 <url>http://repository.springsource.com/maven/bundles/external</url>
271 </repository>
272 </repositories>
273
274 <pluginRepositories>
275 <pluginRepository>
276 <id>gwt-maven-plugins</id>
277 <url>http://gwt-maven.googlecode.com/svn/trunk/mavenrepo/</url>
278 </pluginRepository>
279 </pluginRepositories>
280
281 <distributionManagement>
282 <repository>
283 <id>internal</id>
284 <name>Internal Shared Maven Repository</name>
285 <url>scp://maven/var/www/html/maven2/internal</url>
286 </repository>
287 </distributionManagement>
288
289 </project>