Ich habe das Maven Demoprogramm "mavenproject1" erstellt und in der IDE laufen lassen, ist ok. Dann habe ich ein Build gemacht und versucht diese zu starten. Ergebnis: kein Hauptmanifestattribut, in mavenproject1-1.0-snapshot.jar
Da in der Projektstruktur keine MANIFEST-Datei aufscheint kann ich dort auch keine main-Datei angeben. Diese steht allerdings in der POM-Datei.
Die POM:
[CODE lang="xml" title="POM"]<?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>com.mycompany</groupId>
<artifactId>mavenproject1</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<exec.mainClass>com.mycompany.mavenproject1.Mavenproject1</exec.mainClass>
</properties>
</project>[/CODE]
Die Projektstruktur:

Da in der Projektstruktur keine MANIFEST-Datei aufscheint kann ich dort auch keine main-Datei angeben. Diese steht allerdings in der POM-Datei.
Die POM:
[CODE lang="xml" title="POM"]<?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>com.mycompany</groupId>
<artifactId>mavenproject1</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<exec.mainClass>com.mycompany.mavenproject1.Mavenproject1</exec.mainClass>
</properties>
</project>[/CODE]
Die Projektstruktur:
