2012-02-09 3 views
1

는 나는 다음과 같은 문제가 생겼어요. 이 작업은 단순히 콘솔에 일부 문자열을 표시하는 것입니다. 문제는 내가 처형되는 것을 볼 수는 있지만 업무는 수행되지 않는다는 것이다. 아무도 비슷한 문제가 발생 했습니까?받는다는 자바 받는다는-antrun - 플러그인

<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/xsd/maven-4.0.0.xsd"> 
<modelVersion>4.0.0</modelVersion> 
<groupId>com.mp</groupId> 
<artifactId>parentApp</artifactId> 
<version>0.0.1-SNAPSHOT</version> 
<packaging>pom</packaging> 
<name>parentApp</name> 
<description>This is just to test pom inheritance</description> 


<properties> 
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
</properties> 

<build> 
    <defaultGoal>package</defaultGoal> 
    <plugins> 
     <plugin> 
      <artifactId>maven-antrun-plugin</artifactId> 
      <version>1.1</version> 
      <executions> 
       <execution> 
        <id>echodir</id> 
        <goals> 
         <goal>run</goal> 
        </goals> 
        <phase>verify</phase> 
        <inherited>true</inherited> 
        <configuration> 
         <task> 
          <echo>*************************************************** Build Dir</echo> 
          <mkdir>./hey</mkdir> 
         </task> 
        </configuration> 
       </execution> 
      </executions> 
     </plugin> 
    </plugins> 
</build> 

<dependencyManagement> 
    <dependencies> 
     <dependency> 
      <groupId>junit</groupId> 
      <artifactId>junit</artifactId> 
      <version>3.8.1</version> 
      <scope>test</scope> 
     </dependency> 

     <dependency> 
      <groupId>org.apache.activemq</groupId> 
      <artifactId>activemq-core</artifactId> 
      <version>5.1.0</version> 
     </dependency> 
     <dependency> 
      <groupId>log4j</groupId> 
      <artifactId>log4j</artifactId> 
      <version>1.2.16</version> 
     </dependency> 
    </dependencies> 
</dependencyManagement> 

은 다음 MVN을 확인 를 실행할 때 내가 얻을 출력이 될 때 :

[INFO] Scanning for projects... 
[INFO] 
[INFO] ------------------------------------------------------------------------ 
[INFO] Building parentApp 0.0.1-SNAPSHOT 
[INFO] ------------------------------------------------------------------------ 
[INFO] 
[INFO] --- maven-antrun-plugin:1.1:run (echodir) @ parentApp --- 
[INFO] Executing tasks 
[INFO] Executed tasks 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD SUCCESS 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 0.321s 
[INFO] Finished at: Thu Feb 09 17:28:01 CET 2012 
[INFO] Final Memory: 2M/121M 
[INFO] ------------------------------------------------------------------------ 

을 그래서 사이 결국에는 출력이 없습니다 다음 내 pom.xml 파일의 코드는 작업 실행실행 작업이지만 플러그인 자체가 고려됩니다. 왜 그런가?

+0

받는다는-antrun - 플러그인 1.6 ?? – ollins

+0

예상 출력이 디버그 출력에 있는지 보려면 -e 또는 -X 플래그와 함께 maven을 실행 해 보셨습니까? 즉'mvn -e verify' 또는'mvn -X verify' – hatboyzero

+0

'mkdir' 명령을 제거하고'echo' 만 가지고 있는지 확인해보십시오. 또한, 나는 그 플러그인의 최신 버전을 사용하려고 시도했다 (1.7 현재) – Michael

답변

1

아마도 maven antrun 플러그인의 1.1 버전에 버그가있을 수 있습니다.

다음 스 니펫은 저에게 적합합니다. <mkdir>./hey</mkdirant mkdir task의 구문이 잘못되었습니다. 또한 taskdeprecated이고 target이 유리합니다.

<plugin> 
     <artifactId>maven-antrun-plugin</artifactId> 
     <version>1.7</version> 
     <executions> 
      <execution> 
       <id>echodir</id> 
       <goals> 
        <goal>run</goal> 
       </goals> 
       <phase>verify</phase> 
       <inherited>true</inherited> 
       <configuration> 
        <target> 
         <echo>*************************************************** Build Dir</echo> 
         <mkdir dir="hey"/> 
        </target> 
       </configuration> 
      </execution> 
     </executions> 
    </plugin> 
0

처럼, 확인하는 동안 다른 작업을 수행하십시오 :

의견의 일부에서 언급 한 바와 같이
<copy file="${project.build.directory}/somefile" todir="some dir" 
overwrite="true" /> 
0

이 플러그인의 최신 버전 (1.7)을 사용하여 "어떤 디렉토리에 어떤 파일을 복사". 또한 <task> 태그를 <target> 태그로 바꿉니다. 예 :

<plugin> 
    <artifactId>maven-antrun-plugin</artifactId> 
    <version>1.7</version> 
    <executions> 
     <execution> 
      <id>echodir</id> 
      <goals> 
       <goal>run</goal> 
      </goals> 
      <phase>verify</phase> 
      <inherited>true</inherited> 
      <configuration> 
       <target> 
        <echo>*************************************************** Build Dir</echo> 
       </target> 
      </configuration> 
     </execution> 
    </executions> 
</plugin> 
관련 문제