【问题标题】:How to mark maven plugin threadSafe如何标记maven插件threadSafe
【发布时间】:2014-07-02 13:20:16
【问题描述】:

我想使用@threadSafe 注释将maven-clean-plugin 标记为线程安全。谁能举个例子?

编辑:

升级到 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 文档中,我也明白 clean 插件是线程安全的。即使那样,我也会收到这个警告。所以,我想我错过了什么地方。

【问题讨论】:

  • 你想做什么? clean 插件已经是线程安全的 (maven.apache.org/plugins/maven-clean-plugin/clean-mojo.html)。您使用哪个版本的 maven-clean-plugin?
  • 我没有仔细阅读。您正在使用极旧版本的插件 maven-clean-plugin 2.3、maven-install-plugin 2.2 等。您应该更新插件的定义。

标签: maven-3


【解决方案1】:

首先您尝试使用的原因是旧式 XDoclet 注释已被弃用,您应该 Java 5 annotations like this:

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

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

【讨论】:

猜你喜欢
  • 2011-05-02
  • 1970-01-01
  • 1970-01-01
  • 2017-06-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-11-26
  • 1970-01-01
相关资源
最近更新 更多