尽管代码是使用“maven clean install”进行编译并且创建了.jar文件,但在执行时会抱怨“无主要清单属性,在matrixexplorer-0.0.1.jar中”。我已经在我的pom文件中添加了mainClass标记,所以我无法理解这个问题
这是我的pom文件,
<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>
<version>0.0.1</version>
<groupId>at.tugraz.iicm</groupId>
<artifactId>matrixexplorer</artifactId>
<packaging>jar</packaging>
<build>
<plugins>
<plugin>
<groupId>at.tugraz.iicm</groupId>
<artifactId>matrixexplorer</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>at.tugraz.iicm.matrixexplorer.MatrixExplorerApp</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
<name>matrixexplorer</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>batik-anim</artifactId>
<version>1.8</version>
</dependency>
<dependency>
<groupId>colt</groupId>
<artifactId>colt</artifactId>
<version>1.2.0</version>
</dependency>
<dependency>
<groupId>net.java.dev.appframework</groupId>
<artifactId>appframework</artifactId>
<version>1.03</version>
</dependency>
<dependency>
<groupId>concurrent</groupId>
<artifactId>concurrent</artifactId>
<version>1.3.4</version>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>org.swinglabs</groupId>
<artifactId>swing-worker</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>batik</groupId>
<artifactId>batik-transcoder</artifactId>
<version>1.6-1</version>
</dependency>
</dependencies>
</project>
答案 0 :(得分:0)
在构建部分中,而不是
<groupId>at.tugraz.iicm</groupId>
<artifactId>matrixexplorer</artifactId>
你需要
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.0</version>