0

Despite the code is getting compiled with "maven clean install" and .jar file is created, when executing it complains with "no main manifest attribute, in matrixexplorer-0.0.1.jar". I already added mainClass tag in my pom file so I cant understand the problem

here is my pom file,

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

and my folder structure is as in the image enter image description here

happycoder
  • 33
  • 8
  • Could you unzip the contents of your jar file and put the Manifest.mf file contents in your question please? The clues as to why it fails should be there. – Joao Esperancinha May 29 '16 at 14:58
  • Maybe this will help: http://stackoverflow.com/questions/9689793/cant-execute-jar-file-no-main-manifest-attribute – Peter May 29 '16 at 14:58

1 Answers1

0

in the build section, instead of

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

you need

    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-jar-plugin</artifactId>
    <version>3.0.0</version>
Raphael Roth
  • 26,751
  • 15
  • 88
  • 145