2014-03-02 1 views
0

이것은 우리가 현재 가지고있는 pom.xml 파일입니다 :org.codehaus.mojo에서 java 및 exec를 수행하는 방법 exec-maven-plugin?

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

그러나 대한 :

<?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 파일입니다 (그것은 엽차 cmd를 도구의 실행을 추가) Sencha cmd 도구가 실행되지만 Java org.codehaus.mojo의 기존 실행이 더 이상 발생하지 않는 몇 가지 이유가 있습니다. 내가 뭘 놓치고 있니?

+0

'mvn clean package'의 출력을 표시 할 수 있습니까? – khmarbaise

답변

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을 다른 목표로 실행하려면 두 개의 섹션이 필요합니다.

 `<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> 
관련 문제