gpt4 book ai didi

java - Eclipse + Maven + maven-license-plugin

转载 作者:行者123 更新时间:2023-12-01 15:48:13 25 4
gpt4 key购买 nike

我已将 maven-license-plugin 添加到在 Eclipse 中设置的 Maven 项目。现在它已经配置好了,我无法找到执行它的方法。谁能向我解释一下你如何在 Eclipse 中运行它?谢谢。

pom.xml 文件。

<plugin>
<groupId>com.google.code.maven-license-plugin</groupId>
<artifactId>maven-license-plugin</artifactId>
<version>1.4.0</version>
<configuration>
<header>header.txt</header>
</configuration>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>

右键单击项目,“运行方式”显示 Maven assemble/build/clean/install/package/generate-sources/test/jar 的选项 - 我没有任何其他选项。

尝试:

设置一个外部工具,我将其设置为 ${maven_exec} (在首选项中配置为 mvn.bat 的字符串替换),并带有参数 许可证:格式 -Dyear=2011 -Demail=myaddress@mycompany.com

结果:

Buildfile: C:\dev\dependencies\maven\bin\mvn.bat

BUILD FAILED
C:\dev\dependencies\maven\bin\mvn.bat:1: Content is not allowed in prolog.

最佳答案

根据documentation ,检查目标默认绑定(bind)到 maven build life cycle 的验证阶段.

the default lifecycle has the following build phases (for a complete list of the build phases, refer to the Lifecycle Reference):

  • validate - validate the project is correct and all necessary information is available
  • compile - compile the source code of the project
  • test - test the compiled source code using a suitable unit testing framework. These tests should not require the code be packaged or deployed
  • package - take the compiled code and package it in its distributable format, such as a JAR.
  • integration-test - process and deploy the package if necessary into an environment where integration tests can be run
  • verify - run any checks to verify the package is valid and meets quality criteria
  • install - install the package into the local repository, for use as a dependency in other projects locally
  • deploy - done in an integration or release environment, copies the final package to the remote repository for sharing with other developers and projects.

因此,您需要运行一个以验证为前身的构建阶段,即安装部署
正如您上面所指出的,可以在 Maven 运行菜单上进行安装。
您选择“run as > maven build ...”,系统将提示您执行哪个目标,您可以直接指定验证,并将其保存为名为项目验证的运行配置。

或者,您可以将检查目标绑定(bind)到不同的生命周期阶段,请检查上面的文档链接以了解此配置。

关于java - Eclipse + Maven + maven-license-plugin,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6694063/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com