我正在按照教程创build一个Maven插件,不能运行mvn安装而不会出错。 信息抱怨说,当注释应该为我生成它们时,我没有所需的mojo描述符。 我正在运行maven 3.0.5并使用intellij作为我的ide。 这是我的主要类: @Mojo(name = "modify-connector") public class ComplianceMojo extends AbstractMojo { @Parameter private String artifactId; @Parameter private String version; @Override public void execute() throws MojoExecutionException, MojoFailureException { File jar = new File(getPluginContext().get("project.build.directory") + "/" + getPluginContext().get("project.build.finalname") + "/" + artifactId + "-" + version); if(jar.exists()){ getLog().info("The file exists! " + jar.getAbsolutePath()); } […]
我以为我是一个经验丰富的Maven用户,但我正在思考如何做到这一点! 我已经能够使用Maven的sql插件,通过我已经定义并且绑定到pre-integration-test阶段的插件执行来在数据库中删除,创build和安装模式。 不过,现在我想使用相同的SQL插件插入一些示例数据,只要我想要从命令行 – 也就是说,不绑定到任何生命周期的目标。 有几个不同的样本数据集,所以我想定义一些不同的执行。 但有没有办法通过使用执行ID也许从命令行运行这些执行之一?
我把Maven放在业余群体周围,写得不好,坦率地说 – 原始的C / C ++代码(意思是一些C,一些C ++)。 问题是 – 目前有很多正在stream通,不能轻易更换。 构build它需要很多部落的知识(你必须从立方体到立方体才能find如何编译/构build各个部分),释放是完全的噩梦。 (不 – 我不会重写它,PLZ不问)我的问题是 – 我应该使用maven-native-plugin来replace多个短makefile或使用exec-maven-plugin来执行这些? 到目前为止,我已经有了相当不错的经验 ,不知道我是否应该投资native插件或保持与exec ? 如果你有“Mavenizing”C / C ++的经验,我很乐意得到一些build议。
我正在阅读有关Maven的文章,现在和无处不在,我看到这个词(mojo)。 我大致了解它的意思,但我不会拒绝一个好的解释。 我试图谷歌,但只发现非maven的解释。 POJO – 好的,但MOJO? Maven老Java对象?
我试图使用这里描述的解决scheme来解决烦人的“生命周期configuration不包括的插件执行:org.codehaus.mojo:build-helper-maven-plugin:1.7:add-source(execution:default,phase:generate-来源)“当我把我的pom.xml下面的插件: <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>build-helper-maven-plugin</artifactId> <executions> <execution> <phase>generate-sources</phase> <goals><goal>add-source</goal></goals> <configuration> <sources> <source>src/bootstrap/java</source> </sources> </configuration> </execution> </executions> </plugin> 但是,当我运行mvn干净安装我得到这个: 原因:在存储库中未findPOM'org.eclipse.m2e:lifecycle-mapping':无法从任何存储库下载工件 有没有人有关于如何使m2e和maven快乐的线索?
我使用maven来构build一个多模块项目。 我的模块2依赖于模块1 src在编译范围和模块1testing在testing范围。 第2单元 – <dependency> <groupId>blah</groupId> <artifactId>MODULE1</artifactId> <version>blah</version> <classifier>tests</classifier> <scope>test</scope> </dependency> 这工作正常。 说我的模块3取决于Module1 src并在编译时testing。 第3单元 – <dependency> <groupId>blah</groupId> <artifactId>MODULE1</artifactId> <version>blah</version> <classifier>tests</classifier> <scope>compile</scope> </dependency> 当我运行mvn clean install ,我的构build运行到模块3,在模块3失败,因为它无法解决模块1testing依赖性。 然后,我单独在模块3上进行mvn install ,返回并在我的父pom上运行mvn install以使其生成。 我该如何解决这个问题?
由于我更新到Maven 3我在每个版本得到以下警告消息: 我怎样才能摆脱这些警告? [INFO] Scanning for projects… [WARNING] [WARNING] Some problems were encountered while building the effective model for proj:id:jar:3.1 [WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-javadoc-plugin is missing. @ line 195, column 15 [WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 204, column 15 [WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-surefire-plugin is missing. @ line 227, column 15 [WARNING] 'build.plugins.plugin.version' […]
我想有一个Maven目标触发java类的执行。 我正在尝试通过以下行迁移Makefile : neotest: mvn exec:java -Dexec.mainClass="org.dhappy.test.NeoTraverse" 我希望mvn neotest生产目前make neotest东西。 exec插件文档和Maven Ant任务页面都没有任何简单的例子。 目前,我在: <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.1</version> <executions><execution> <goals><goal>java</goal></goals> </execution></executions> <configuration> <mainClass>org.dhappy.test.NeoTraverse</mainClass> </configuration> </plugin> 不过,我不知道如何从命令行触发插件。
我有一个要求用Maven创buildjar文件,但是他们需要用一个“foobar”扩展名来安装到版本库中,如果他们有自己的包装types,那么我们可以通过包装来识别这些工件。 我可以设置一个新的包装types来做到这一点?
我已经确定了Maven 2的两个JAXB插件存在,有一些不同的configuration。 其中一个来自Sun: http ://jaxb.dev.java.net/jaxb-maven2-plugin/,另一个来自Mojohaus: http ://mojohaus.org/jaxb2-maven-plugin/ 这两个插件哪个可以推荐? 谢谢Matt。 在我这个小小的研究项目上,我发现还有另外一个插件: <groupId>com.sun.tools.xjc.maven2</groupId> <artifactId>maven-jaxb-plugin</artifactId> 那一个: <groupId>org.jvnet.jaxb2.maven2</groupId> <artifactId>maven-jaxb2-plugin</artifactId> 还是来自Codehouse的。