![](/img/trans.png)
[英]Maven maven-assembly-plugin jar-with-dependencies exclude LICENSE.txt from final jar
[英]How to add License.txt to Maven project
我正在尝试通过插件将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
该错误与插件无关。 据错误提示,据我从Maven XSD得知,您的organizationName
标记确实无效。 尝试将其替换为organization
。 那确实存在。
<organization>
<name>My Organization</name>
<url>http://example.com</url>
</organization>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.