繁体   English   中英

Maven找不到要执行的主类

[英]Maven can't find the main class for execution

尽管使用“ 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>

我的文件夹结构如图片所示 在此处输入图片说明

在构建部分,而不是

     <groupId>at.tugraz.iicm</groupId>
     <artifactId>matrixexplorer</artifactId>

你需要

    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-jar-plugin</artifactId>
    <version>3.0.0</version>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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