【问题标题】:appengine-maven-plugin not auto deploying code after code changesappengine-maven-plugin 在代码更改后不会自动部署代码
【发布时间】:2014-09-02 13:17:32
【问题描述】:

我有一个使用新推荐的模块结构的 appengine maven 项目。所以我有一个耳朵模块,它又包含 2 个战争子模块。我正在使用 run mvn appengine:devserver from ear 目录来运行代码。我希望 Maven 在保存后立即部署任何代码更改,以便我可以刷新浏览器并查看更改,但这似乎不起作用。这是我的耳塞。

目标/${project.artifactId}-${project.version}/*/WEB-INF/classes org.apache.maven.plugins maven-ear-插件 2.8 5 库 战争 com.google.appengine appengine-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 指令下的 buildOuputput 目录中添加并指定了

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

在 appengine-maven-plugin 插件下。我还在 netbeans 中启用了 compile on save 选项,但 maven 似乎没有在 devappserver 运行时扫描类文件夹并部署更改。

现在,对于每个小的更改,我都陷入了干净的构建/部署周期。非常感谢您对此的任何帮助。

【问题讨论】:

    标签: maven autodeploy appengine-maven-plugin


    【解决方案1】:

    我设法让它在 Eclipse 中工作,方法是从编译阶段调用 war:exploded 并在 m2e 配置中添加一个映射,以便它在 Eclipse 的增量构建中运行它。我不确定这在 Netbeans 中是如何工作的,但也许我的 Eclipse 解决方案会对您有所帮助。

    以下是我的 pom 的相关部分:

    这是配置war:exploded执行的部分:

             <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 的 build 部分):

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-11-07
      相关资源
      最近更新 更多