如何标记maven插件threadSafe

时间:2014-06-27 09:37:27

标签: maven-3

我想使用maven-clean-plugin注释将@threadSafe标记为线程安全。任何人都可以举个例子吗?

修改

升级到maven 3.0.5后,我的版本低于警告:(使用teamcity构建)

[18:51:10][com.dir.hay.straw:straw-parent] [WARNING] *****************************************************************Agent time: 14:21:10

[18:51:10][com.dir.hay.straw:straw-parent] [WARNING] * Your build is requesting parallel execution, but project      *Agent time: 14:21:10

[18:51:10][com.dir.hay.straw:straw-parent] [WARNING] * contains the following plugin(s) that are not marked as       *Agent time: 14:21:10

[18:51:10][com.dir.hay.straw:straw-parent] [WARNING] * @threadSafe to support parallel building.                     *Agent time: 14:21:10

[18:51:10][com.dir.hay.straw:straw-parent] [WARNING] * While this /may/ work fine, please look for plugin updates    *Agent time: 14:21:10

[18:51:10][com.dir.hay.straw:straw-parent] [WARNING] * and/or request plugins be made thread-safe.                   *Agent time: 14:21:10

[18:51:10][com.dir.hay.straw:straw-parent] [WARNING] * If reporting an issue, report it against the plugin in        *Agent time: 14:21:10

[18:51:10][com.dir.hay.straw:straw-parent] [WARNING] * question, not against maven-core                              *Agent time: 14:21:10

[18:51:10][com.dir.hay.straw:straw-parent] [WARNING] *****************************************************************Agent time: 14:21:10

[18:51:10][com.dir.hay.straw:straw-parent] [WARNING] The following plugins are not marked @threadSafe in STRAW Main Application:Agent time: 14:21:10

[18:51:10][com.dir.hay.straw:straw-parent] [WARNING] org.apache.maven.plugins:maven-clean-plugin:2.3Agent time: 14:21:10

[18:51:10][com.dir.hay.straw:straw-parent] [WARNING] org.apache.maven.plugins:maven-install-plugin:2.2Agent time: 14:21:10

[18:51:10][com.dir.hay.straw:straw-parent] [WARNING] *****************************************************************

从maven文档中,我也明白干净的插件是线程安全的。即使这样,我也会收到这个警告。所以,我以为我想念某个地方。

1 个答案:

答案 0 :(得分:2)

首先尝试使用的是旧式XDoclet注释,不推荐使用Java 5 annotations like this

你想做什么? maven-clean-plugin is already thread safe。{{3}}。你使用哪个版本的maven-clean-plugin?

@Mojo( name = "WhatEver",
       threadSafe = true)
public class MyMojo
    extends AbstractMojo