我有一个appengine maven项目,它使用了最新推荐的模块结构。所以我有一个耳朵模块,它又包含两个战争子模块。我使用ear目录中的run-mvnappengine:devserver来运行代码。我希望maven在保存代码后立即部署任何代码更改,这样我就可以刷新浏览器并查看更改,但这似乎不起作用。这是我的耳塞。
目标/${project.artifactId}-${project.version}/*/WEB-INF/classesorg.apache.maven.pluginsmaven ear插件2.85.lib战争com.google.appengineappengine maven插件${appengine.target.version}2.
<dependencies>
<dependency>
<groupId>com.blah.app</groupId>
<artifactId>A</artifactId>
<version>1.0-SNAPSHOT</version>
<type>war</type>
</dependency>
<dependency>
<groupId>com.blah.backend</groupId>
<artifactId>B</artifactId>
<version>1.0-SNAPSHOT</version>
<type>war</type>
</dependency>
</dependencies>
根据https://developers.google.com/appengine/docs/java/tools/maven上的建议,我在build指令下的buildOputput目录中添加了
<configuration>
<fullScanSeconds>2</fullScanSeconds>
</configuration>
在appengine maven插件插件下。我还在netbeans中启用了保存时编译选项,但maven似乎没有在devappserver运行时扫描classes文件夹并部署更改。
现在,对于每一个小的更改,我都被困在干净的构建/部署周期中。我真的很感谢在这方面的任何帮助。
我通过从编译阶段调用war:blasted并在m2e配置中添加映射,使其在Eclipse中的增量构建中运行,从而使其在Eclipse中运行。我不确定这在Netbeans中会如何工作,但也许我的Eclipse解决方案会对您有所帮助。
以下是我的pom:的相关部分
这是配置战争的部分:爆炸执行:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<archiveClasses>true</archiveClasses>
<webResources>
<!-- in order to interpolate version from pom into appengine-web.xml -->
<resource>
<directory>${basedir}/src/main/webapp/WEB-INF</directory>
<filtering>true</filtering>
<targetPath>WEB-INF</targetPath>
</resource>
</webResources>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>exploded</goal>
</goals>
</execution>
</executions>
</plugin>
这是配置m2e的部分(它位于pom.xml的构建部分):
<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-war-plugin
</artifactId>
<versionRange>
[2.4,)
</versionRange>
<goals>
<goal>
exploded
</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute>
<runOnIncremental>true</runOnIncremental>
<runOnConfiguration>true</runOnConfiguration>
</execute>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>