0

My project contains Application classes having main(), which is also mentioned in manifest file as below

Manifest-Version: 1.0
Main-Class: org.carleton.cep.Application

Till now, build artifact option is greyed out, so I tried to add it to artifacts as shown below

enter image description here

enter image description here

When I press OK, I got following error,

enter image description here

Then, I created an unnamed build by selection empty

enter image description here

But Whenever I execute `build artifacts', no JAR file is generated

Do I need to specify main class in pom.xml as well, if yes how ?

Amarjit Dhillon
  • 2,718
  • 3
  • 23
  • 62

1 Answers1

2

You need to define the main class in the configuration for Maven:

<project>
  ...
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        ...
        <configuration>
          <archive>
            <manifest>
              <addClasspath>true</addClasspath>
              <mainClass>fully.qualified.MainClass</mainClass>
            </manifest>
          </archive>
        </configuration>
        ...
      </plugin>
    </plugins>
  </build>
khmarbaise
  • 92,914
  • 28
  • 189
  • 235