the pom.xml
file:
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>tech.saundersconsulting</groupId>
<artifactId>mavenchimp</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<exec.mainClass>tech.mavenchimp.App</exec.mainClass>
</properties>
<repositories>
<repository>
<id>java-net-repo</id>
<url>https://maven.java.net/content/repositories/public/</url>
</repository>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.github.banana-j</groupId>
<artifactId>bananaj</artifactId>
<version>0.6.2</version>
</dependency>
<dependency>
<groupId>com.github.NetoDevel</groupId>
<artifactId>mailchimp-java</artifactId>
<version>0.1.5</version>
</dependency>
</dependencies>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>tech.mavenchimp.App</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</project>
the mvn
error:
nicholas@mordor:~/NetBeansProjects/mavenchimp$
nicholas@mordor:~/NetBeansProjects/mavenchimp$ mvn clean
[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[ERROR] Malformed POM /home/nicholas/NetBeansProjects/mavenchimp/pom.xml: Unrecognised tag: 'plugins' (position: START_TAG seen ...</dependencies>\n <plugins>... @36:12) @ /home/nicholas/NetBeansProjects/mavenchimp/pom.xml, line 36, column 12
@
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project tech.saundersconsulting:mavenchimp:1.0-SNAPSHOT (/home/nicholas/NetBeansProjects/mavenchimp/pom.xml) has 1 error
[ERROR] Malformed POM /home/nicholas/NetBeansProjects/mavenchimp/pom.xml: Unrecognised tag: 'plugins' (position: START_TAG seen ...</dependencies>\n <plugins>... @36:12) @ /home/nicholas/NetBeansProjects/mavenchimp/pom.xml, line 36, column 12 -> [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
nicholas@mordor:~/NetBeansProjects/mavenchimp$
if I take out the plugins node, the project at least builds:
nicholas@mordor:~/NetBeansProjects/mavenchimp$
nicholas@mordor:~/NetBeansProjects/mavenchimp$ mvn clean package
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------< tech.saundersconsulting:mavenchimp >-----------------
[INFO] Building mavenchimp 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ mavenchimp ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ mavenchimp ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/nicholas/NetBeansProjects/mavenchimp/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ mavenchimp ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 3 source files to /home/nicholas/NetBeansProjects/mavenchimp/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ mavenchimp ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/nicholas/NetBeansProjects/mavenchimp/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ mavenchimp ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ mavenchimp ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ mavenchimp ---
[INFO] Building jar: /home/nicholas/NetBeansProjects/mavenchimp/target/mavenchimp-1.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.658 s
[INFO] Finished at: 2020-12-07T02:24:18-08:00
[INFO] ------------------------------------------------------------------------
nicholas@mordor:~/NetBeansProjects/mavenchimp$
but, I'm looking to specify the main class in the manifest for the JAR
above.
I am not sure whats your question related to jar, but your build is failing because you have put tag directly instead of within the build tag. it should be like -
<build>
<plugins>
<plugin>
</plugin>
</plugins>
</build>