我按照this blog post by 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
知道为什么它不起作用吗?
答案 0 :(得分:4)
Codehaus jruby-maven-plugin似乎已于5年前被废弃。如果您使用的是Maven3,可以尝试使用Maven2,但我会查看https://github.com/torquebox/jruby-maven-plugins