1

我按照Sonatype 的这篇博文中关于用 Ruby 编写 Maven 插件的说明进行操作。

当我尝试运行mvn install(Maven 3.0.4)时,构建成功,但maven-plugin-plugin找不到任何 mojo 描述符:

[INFO] ------------------------------------------------------------------------
[INFO] Building Example Ruby Mojo - firstruby-maven-plugin 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for org.jruby:jruby:jar:0.9.9 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[INFO]
[INFO] --- maven-plugin-plugin:2.4:descriptor (default-descriptor) @ firstruby-maven-plugin ---
[INFO] Using 3 extractors.
[INFO] Applying extractor for language: java
[INFO] Extractor for language: java found 0 mojo descriptors.
[INFO] Applying extractor for language: jruby
[INFO] Extractor for language: jruby found 0 mojo descriptors.
[INFO] Applying extractor for language: bsh
[INFO] Extractor for language: bsh found 0 mojo descriptors.

如果我尝试将maven-plugin-plugin版本升级到高于 2.4 的版本,则构建失败并显示以下错误消息:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-plugin-plugin:2.5:descriptor (default-descriptor) on project firstruby-maven-plugin: The API of the mojo scanner is not compatible with this plugin version. Please check the plugin dependencies configured in the POM and ensure the versions match. org.apache.maven.tools.plugin.scanner.MojoScanner.populatePluginDescriptor(Lorg/apache/maven/tools/plugin/PluginToolsRequest;)V -> [Help 1]

这是tree显示目录结构正常的输出:

firstruby-maven-plugin
├── pom.xml
└── src
    └── main
        └── scripts
            └── echo.rb

3 directories, 2 files

知道为什么它不起作用吗?

4

1 回答 1

4

Codehaus jruby-maven-plugin 似乎在 5 年前就被抛弃了。如果您使用的是 Maven3,您可以尝试使用 Maven2,但我会查看https://github.com/torquebox/jruby-maven-plugins

于 2012-08-28T09:41:27.317 回答