gpt4 book ai didi

java - 如何将License.txt添加到Maven项目中

转载 作者:行者123 更新时间:2023-12-02 11:37:31 25 4
gpt4 key购买 nike

我正在尝试通过插件将 LICENSE.txt 添加到我的 Maven 项目中。

我尝试使用 org.codehaus.mojo license-maven-plugin 1.14,并包含以下 pom 条目...

 <organizationName>My Organization</organizationName>
<inceptionYear>2018</inceptionYear>

<licenses>
<license>
<name>GNU-JEFF General Public License (GPL)</name>
<url>http://www.gnu.org/licenses/gpl.txt</url>
</license>
</licenses>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId>
<version>1.14</version>
<configuration>
<verbose>false</verbose>
<addSvnKeyWords>true</addSvnKeyWords>
</configuration>
<executions>
<execution>
<id>first</id>
<goals>
<goal>update-file-header</goal>
</goals>
<phase>process-sources</phase>
<configuration>
<licenseName>gpl_v3</licenseName>
<organizationName>My Organization</organizationName>
<inceptionYear>2017</inceptionYear>
<roots>
<root>src/main/java</root>
<root>src/test</root>
</roots>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

但是使用以下命令...

mvn license:update-project-license

我收到此错误...

[INFO] Scanning for projects...
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project com.pcmsgroup.v21.pos.tools:confluence-updater:2.0.1-SNAPSHOT (C:\x\pom.xml) has 1 error
[ERROR] Malformed POM C:\x\pom.xml: Unrecognised tag: 'organizationName' (position: START_TAG seen ...</packaging>\r\n\t\r\n<organizationName>... @9:19) @ C:\tools\workspace\POS-ConfluenceUpdater\pom.xml, line 9, column 19 -> [Help 2]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/ModelParseException

最佳答案

该错误与插件无关。据我所知the Maven XSD ,您的 organizationName 标记确实无效,如错误所示。尝试将其替换为organization。这个确实存在。

<organization>
<name>My Organization</name>
<url>http://example.com</url>
</organization>

关于java - 如何将License.txt添加到Maven项目中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48824142/

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