我有一个使用maven构建的web应用程序(即maven-war-plugin)的情况。对于每个代码修改,我们必须手动启动maven并重新启动应用程序服务器。现在,为了减少构建周期开销,我想使用WTP来发布webapp。用m2eclipse和WTP一起构建WAR(处理webResources)
现在,我们使用Maven进行资源处理,并且在构建webapp时,我们在POM中定义了一些额外的Maven任务。因此m2eclipse似乎是一个自然的解决方案。
我已经得到足够多,Maven构建器正在运行这些任务并正确过滤资源。但是,当我选择“在服务器上运行”时,WAR文件看起来并不像我在Maven中构建它时那样。
我是猜测这是因为WTP实际上构建的是WAR,而不是m2eclipse构建器。所以即使我们在我们的POM中配置了maven-war-plugin,这些设置也不会被使用。
下面是我们的maven-war-plugin配置的一个片段。什么是在“webResources”不拿起配置,看来:
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1-alpha-2</version>
<configuration>
<outputDirectory>${project.build.directory}</outputDirectory>
<workDirectory>${project.build.directory}/work</workDirectory>
<webappDirectory>${project.build.webappDirectory}</webappDirectory>
<cacheFile>${project.build.webappDirectory}/webapp-cache.xml</cacheFile>
<filteringDeploymentDescriptors>true</filteringDeploymentDescriptors>
<nonFilteredFileExtensions>
<nonFilteredFileExtension>pdf</nonFilteredFileExtension>
<nonFilteredFileExtension>png</nonFilteredFileExtension>
<nonFilteredFileExtension>gif</nonFilteredFileExtension>
<nonFilteredFileExtension>jsp</nonFilteredFileExtension>
</nonFilteredFileExtensions>
<webResources>
<!-- Add generated WSDL:s and XSD:s for the web service api. -->
<resource>
<directory>${project.build.directory}/jaxws/wsgen/wsdl</directory>
<targetPath>WEB-INF/wsdl</targetPath>
<filtering>false</filtering>
<includes>
<include>**/*</include>
</includes>
</resource>
</webResources>
</configuration>
我是否需要重新配置这些资源在其他地方处理,或者是有没有更好的解决办法?
谢谢!在这种情况下,我最终使用了线程中的hack。 – waxwing 2010-05-18 13:58:01