2014-11-15 97 views
6

我注意到每當我在MAVEN中運行我的exec:java命令時,都會收到此警告。killAfter在運行exec時不推薦使用的警告:java

[警告]警告:現在不推薦使用killAfter。你需要它嗎 ?請對MEXEC-6發表評論。

我該如何擺脫它?我一直在尋找它,但沒有線索。

的pom.xml:

<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>foodfinder</groupId> 
    <artifactId>food-client</artifactId> 
    <version>0.0.1-SNAPSHOT</version> 
    <name>Food Finder client</name> 
    <description>The client application for the Food Finder</description> 
    <dependencies> 
    <dependency> 
     <groupId>org.json</groupId> 
     <artifactId>json</artifactId> 
     <version>20140107</version> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.uima</groupId> 
     <artifactId>uimaj-tools</artifactId> 
     <version>2.6.0</version> 
    </dependency> 
    <dependency> 
     <groupId>commons-validator</groupId> 
     <artifactId>commons-validator</artifactId> 
     <version>1.4.0</version> 
    </dependency> 
    <dependency> 
     <groupId>com.razican.utils</groupId> 
     <artifactId>java-utils</artifactId> 
     <version>0.1.0</version> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.commons</groupId> 
     <artifactId>commons-lang3</artifactId> 
     <version>3.3.2</version> 
    </dependency> 
    </dependencies> 
    <properties> 
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
    </properties> 
    <issueManagement> 
    <system>GitHub</system> 
    <url>https://github.com/Razican/FoodClient/issues</url> 
    </issueManagement> 
    <ciManagement> 
    <system>Travis-CI</system> 
    <url>https://travis-ci.org/Razican/FoodClient</url> 
    </ciManagement> 
    <repositories> 
    <repository> 
     <id>Java-Utils</id> 
     <url>https://raw.github.com/Razican/Java-Utils/mvn-repo/</url> 
     <snapshots> 
      <enabled>true</enabled> 
      <updatePolicy>always</updatePolicy> 
     </snapshots> 
    </repository> 
    </repositories> 
    <build> 
    <plugins> 
     <plugin> 
     <groupId>org.apache.maven.plugins</groupId> 
     <artifactId>maven-compiler-plugin</artifactId> 
     <version>3.2</version> 
     <configuration> 
      <source>1.7</source> 
      <target>1.7</target> 
     </configuration> 
     </plugin> 
     <plugin> 
     <groupId>org.apache.maven.plugins</groupId> 
     <artifactId>maven-assembly-plugin</artifactId> 
     <version>2.5.1</version> 
     <configuration> 
      <archive> 
      <manifest> 
       <mainClass>foodfinder.client.Launcher</mainClass> 
      </manifest> 
      </archive> 
      <descriptorRefs> 
      <descriptorRef>jar-with-dependencies</descriptorRef> 
      </descriptorRefs> 
     </configuration> 
     </plugin> 
     <plugin> 
     <groupId>org.codehaus.mojo</groupId> 
     <artifactId>exec-maven-plugin</artifactId> 
     <version>1.3.2</version> 
      <executions> 
      <execution> 
       <goals> 
       <goal>java</goal> 
       </goals> 
      </execution> 
      </executions> 
      <configuration> 
      <mainClass>foodfinder.client.Launcher</mainClass> 
      </configuration> 
     </plugin> 
    </plugins> 
    </build> 
</project> 
+0

也許您應該閱讀MEXEC-6 JIRA問題。 – chrylis

回答

8

爲了擺脫這個警告你需要修改你的pom.xml

<plugin> 
    <groupId>org.codehaus.mojo</groupId> 
    <artifactId>exec-maven-plugin</artifactId> 
    <version>1.3.2</version> 
     <executions> 
     <execution> 
      <goals> 
      <goal>java</goal> 
      </goals> 
     </execution> 
     </executions> 
     <configuration> 
     <!-- 
      to get rid of the warning: [WARNING] Warning: killAfter is now deprecated. Do you need it ? Please comment on MEXEC-6. 
      see: method execute() in https://github.com/ispringer/exec-maven-plugin/blob/master/src/main/java/org/codehaus/mojo/exec/ExecJavaMojo.java 
     --> 
     <killAfter>-1</killAfter> 
     <mainClass>foodfinder.client.Launcher</mainClass> 
     </configuration> 
    </plugin> 

編輯這個答案是不再有效的較新版本(>exec-maven-plugin的1.3.2)。

對於選民來說,請看看時間表。

Jul 2014 - release of plugin version 1.3.2 
Nov 2014 - posting this answer 
Mar 2015 - release of plugin version 1.4.0 
+1

除了擺脫消息之外,實際上做了什麼? – jjpe

+1

@jjpe看一下[killAfter!= -1]的源代碼搜索(https://github.com/ispringer/exec-maven-plugin/blob/master/src/main/java/org/codehaus/mojo /exec/ExecJavaMojo.java#L251)。如果你不需要這個選項,這是你決定壓制或不壓制。如果你需要這個選項,你應該對提到的錯誤報告留下評論。 – SubOptimal

2

選擇一個:

1)通過添加改變你POM EXEC-行家-插件配置:

<killAfter>-1</killAfter> 

2)或添加命令行參數:

-Dexec.killAfter=-1 
8

更新到exec-maven-plugin的1.4.0版本。警告不再出現。