2014-09-02 32 views
1

我有一个appengine maven项目,它使用了新推荐的模块结构。所以我有一个耳模块,它又包含2个战争子模块。我正在使用运行mvn appengine:ear目录下的devserver来运行代码。我希望Maven在我保存后立即部署任何代码更改,以便刷新浏览器并查看更改,但似乎无法正常工作。这是我的耳筒。appengine-maven-plugin在代码更改后没有自动部署代码

目标/ $ {project.artifactId} - $ {project.version}/*/WEB-INF/classes中 org.apache.maven.plugins 行家入耳式插件 2.8 LIB 战争 com.google.appengine AppEngine上,Maven的插件 $ {} appengine.target.version

<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> 

继我在buildOuputput目录下添加构建指令,并还对https://developers.google.com/appengine/docs/java/tools/maven的推荐标准规定

<configuration> 
    <fullScanSeconds>2</fullScanSeconds> 
</configuration> 

下的AppEngine,Maven的插件插件。我也启用了netbeans中的保存选项编译,但maven似乎没有在devappserver运行时扫描classes文件夹并部署更改。

现在我陷入干净的构建/部署周期,每一个小小的变化。我非常感谢这方面的帮助。

回答

0

我设法通过调用war来让它在Eclipse中工作:从编译阶段爆炸并在m2e配置中添加映​​射,以便它在Eclipse中以增量构建方式运行。我不确定Netbeans如何工作,但也许我的Eclipse解决方案可以帮助你。

这里是我的聚甲醛的相关部分:

这是配置战争的一部分:爆炸执行:

  <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(它会在聚甲醛的生成部分.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>