简体   繁体   中英

Maven not recognising 'configuration' tag in pom.xml

I am trying to put this in my pom.xml-

<configuration>
  <archive>
    <manifest>
  <mainClass>com.limetray.helper.App</mainClass>
    </manifest>
  </archive>
</configuration>

but getting this error-

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]

My 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>

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>

Refer to the Apache Maven Jar Plugin documentation here: https://maven.apache.org/plugins/maven-jar-plugin/index.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM