Maven无法识别pom.xml中的"configuration"标记 [英] Maven not recognising 'configuration' tag in pom.xml
本文介绍了Maven无法识别pom.xml中的"configuration"标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试将其放入我的pom.xml-
I am trying to put this in my pom.xml-
<configuration>
<archive>
<manifest>
<mainClass>com.limetray.helper.App</mainClass>
</manifest>
</archive>
</configuration>
但出现此错误-
Malformed POM /home/rakesh/Desktop/limetray/lt-utils/pom.xml: Unrecognised tag: 'configuration' (position: START_TAG seen ...<url>http://maven.apache.org</url>\n <configuration>... @10:18) @ /home/rakesh/Desktop/limetray/lt-utils/pom.xml, line 10, column 18 -> [Help 2]
我的pom.xml-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.limetray.helper</groupId>
<artifactId>maven-jar-plugin</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>lt-utils</name>
<url>http://maven.apache.org</url>
<configuration>
<archive>
<manifest>
<mainClass>com.limetray.helper.App</mainClass>
</manifest>
</archive>
</configuration>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
推荐答案
您发布的<configuration>
代码段属于<plugin>
标记内.具体来说,它属于Apache Maven Jar插件内部.请参阅下面的示例,以了解您在做什么错.
The <configuration>
snippet you have posted belongs inside a <plugin>
tag. Specifically, it belongs inside the Apache Maven Jar Plugin. Refer to the sample below to get an idea of what you are doing wrong.
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<archive>
<manifest>
<mainClass>com.limetray.helper.App</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
请参阅此处的Apache Maven Jar插件文档: https://maven.apache.org/plugins/maven-jar-plugin/index.html
Refer to the Apache Maven Jar Plugin documentation here: https://maven.apache.org/plugins/maven-jar-plugin/index.html
这篇关于Maven无法识别pom.xml中的"configuration"标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文