0

これは、現在持っている pom.xml です。

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>
    <groupId>com.atlantis.amc</groupId>
    <name>amc-gui</name>
    <artifactId>gui</artifactId>

    <properties>
        <jettyVersion>8.1.9.v20130131</jettyVersion>
    </properties>

    <parent>
        <groupId>com.atlantis</groupId>
        <artifactId>amc</artifactId>
        <version>5.0.0.47</version>
        <relativePath>..</relativePath>
    </parent>

    <dependencies>
        <!-- Servlet API -->
        <!--dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> 
            </dependency -->

        <!-- Jetty -->
        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-webapp</artifactId>
            <version>${jettyVersion}</version>
        </dependency>

        <!-- For the ProxyServlet -->
        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-servlets</artifactId>
            <version>${jettyVersion}</version>
        </dependency>

        <!-- JSP Support -->
        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-jsp-2.1</artifactId>
            <version>7.2.2.v20101205</version>
        </dependency>
        <dependency>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>jsp-2.1-glassfish</artifactId>
            <version>2.1.v20100127</version>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.2</version>
                <configuration>
                    <finalName>amc-gui</finalName>
                    <archiveClasses>true</archiveClasses>
                    <archive>
                        <manifest>
                            <mainClass>com.atlantis.amc.AmcWebApp</mainClass>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>2.1</version>
                <configuration>
                    <finalName>amc-server</finalName>
                    <createDependencyReducedPom>true</createDependencyReducedPom>
                    <!-- <minimizeJar>true</minimizeJar> -->
                    <filters>
                        <filter>
                            <artifact>*:*</artifact>
                            <excludes>
                                <exclude>junit:junit</exclude>
                                <exclude>jmock:*</exclude>
                                <exclude>org.apache.maven:lib:tests</exclude>
                                <exclude>log4j:log4j:jar:</exclude>
                                <exclude>META-INF/*.SF</exclude>
                                <exclude>META-INF/*.DSA</exclude>
                                <exclude>META-INF/*.RSA</exclude>
                            </excludes>
                        </filter>
                    </filters>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                        <finalName>amc-gui</finalName>
                            <!-- <minimizeJar>true</minimizeJar> -->
                            <transformers>
                                <transformer
                                    implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
                                <transformer
                                    implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                    <mainClass>com.atlantis.amc.AmcWebApp</mainClass>
                                </transformer>
                            </transformers>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.2</version>
                <configuration>
                    <mainClass>com.atlantis.amc.AmcWebApp</mainClass>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

そして、これが必要だと思った pom.xml です (sencha cmd ツールの実行を追加します):

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>
    <groupId>com.atlantis.amc</groupId>
    <name>amc-gui</name>
    <artifactId>gui</artifactId>

    <properties>
        <jettyVersion>8.1.9.v20130131</jettyVersion>
    </properties>

    <parent>
        <groupId>com.atlantis</groupId>
        <artifactId>amc</artifactId>
        <version>5.0.0.47</version>
        <relativePath>..</relativePath>
    </parent>

    <dependencies>
        <!-- Servlet API -->
        <!--dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> 
            </dependency -->

        <!-- Jetty -->
        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-webapp</artifactId>
            <version>${jettyVersion}</version>
        </dependency>

        <!-- For the ProxyServlet -->
        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-servlets</artifactId>
            <version>${jettyVersion}</version>
        </dependency>

        <!-- JSP Support -->
        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-jsp-2.1</artifactId>
            <version>7.2.2.v20101205</version>
        </dependency>
        <dependency>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>jsp-2.1-glassfish</artifactId>
            <version>2.1.v20100127</version>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.2</version>
                <configuration>
                    <finalName>amc-gui</finalName>
                    <archiveClasses>true</archiveClasses>
                    <archive>
                        <manifest>
                            <mainClass>com.atlantis.amc.AmcWebApp</mainClass>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>2.1</version>
                <configuration>
                    <finalName>amc-server</finalName>
                    <createDependencyReducedPom>true</createDependencyReducedPom>
                    <!-- <minimizeJar>true</minimizeJar> -->
                    <filters>
                        <filter>
                            <artifact>*:*</artifact>
                            <excludes>
                                <exclude>junit:junit</exclude>
                                <exclude>jmock:*</exclude>
                                <exclude>org.apache.maven:lib:tests</exclude>
                                <exclude>log4j:log4j:jar:</exclude>
                                <exclude>META-INF/*.SF</exclude>
                                <exclude>META-INF/*.DSA</exclude>
                                <exclude>META-INF/*.RSA</exclude>
                            </excludes>
                        </filter>
                    </filters>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                        <finalName>amc-gui</finalName>
                            <!-- <minimizeJar>true</minimizeJar> -->
                            <transformers>
                                <transformer
                                    implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
                                <transformer
                                    implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                    <mainClass>com.atlantis.amc.AmcWebApp</mainClass>
                                </transformer>
                            </transformers>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.2</version>
                <configuration>
                    <mainClass>com.atlantis.amc.AmcWebApp</mainClass>
                </configuration>
                <executions>
                    <execution>
                        <id>sencha-compile</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <executable>sencha</executable>
                            <workingDirectory>src/main/extApps/usx</workingDirectory>
                            <arguments>
                                <argument>app</argument>
                                <argument>build</argument>
                            </arguments>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

しかし、何らかの理由で sencha cmd ツールは実行されますが、Java org.codehaus.mojo の既存の実行はもう行われません。私は何が欠けていますか?

4

1 に答える 1

0

実行の説明を maven プラグインに追加すると、maven プラグインのデフォルトの動作が上書きされます。プラグインは、プラグインから ExecJavaMojo.class を実行しなくなりました。あなたの目的は、プラグインの ExecJavaMojo と ExecMojo を実行するようです。( http://svn.codehaus.org/mojo/tags/exec-maven-plugin-1.2.1/src/main/java/org/codehaus/mojo/exec/ )

この問題を修正するには、異なる目的で exec-maven-plugin をトリガーする 2 つのセクションが必要です。

      `<plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>1.2</version>
            <executions>               <!-- trigger plugin with goal exec -->
                <execution>
                    <id>sencha-compile</id>
                    <phase>compile</phase>
                    <goals>
                        <goal>exec</goal>
                    </goals>
                    <configuration>
                        <executable>sencha</executable>
                        <workingDirectory>src/main/extApps/usx</workingDirectory>
                        <arguments>
                            <argument>app</argument>
                            <argument>build</argument>
                        </arguments>
                    </configuration>
                </execution>
                <execution> <!-- trigger plugin with goal java .... id,phase and goals should be optional cause you use default settings as in your first pom.xml -->
                    <id>stackoverflow</id>
                    <phase>validate</phase>
                    <goals>
                        <goal>java</goal>
                    </goals>
                  <configuration>
                    <mainClass>com.atlantis.amc.AmcWebApp</mainClass>
                  </configuration>
                </execution>
            </executions>
        </plugin>
于 2014-03-02T15:51:07.713 に答える