What is the correct way to specify the main class when packaging a jar using m2eclipse?

Problem: I would like to specify the main class in the jar file that I am packing using m2eclipse: [right-click] → Run As → Maven package. I'm still learning Maven and from what I read, the correct way to solve this problem is to add a stanza to pom.xml.
Here are the examples I found when I investigated this problem:

My question is: Can I manually edit the pom.xml file outside of Eclipse / m2eclipse using a text editor, or do I need to do this configuration using the m2ecplise GUI? There are several tabbed dialogs that seem likely candidates for this task, such as Plugins and Build. I looked through the Sonatype documentation and could not find detailed instructions on how to accomplish what I needed to do.

I manually edited pom.xml a bit hesitantly because I noticed that there are already a lot of unnecessary things in Effective POM, including the definition of a plugin that needs to be added to it:

<plugin>
    <artifactId>maven-jar-plugin</artifactId>
    <version>2.3.1</version>
    <executions>
      <execution>
        <id>default-jar</id>
        <phase>package</phase>
        <goals>
          <goal>jar</goal>
        </goals>
      </execution>
    </executions>
  </plugin>

If I understand correctly, Effective POM needs to be changed so that the plugin is configured as follows:

<plugin>
    <artifactId>maven-jar-plugin</artifactId>
    <version>2.3.1</version>
    <executions>
      <execution>
        <id>default-jar</id>
        <phase>package</phase>
        <goals>
          <goal>jar</goal>
        </goals>
      </execution>
    </executions>
    <configuration>
    <archive>
    <manifest>
         <mainClass>[name of main class]</mainClass>
         <packageName>[package name]</packageName>
    </manifest>
        <manifestEntries>
            <mode>development</mode>
            <url>${pom.url}</url>
    </manifestEntries>
    </archive>
    </configuration>
  </plugin>

? , m2eclipse Effective POM pom.xml ?

, .

UPDATE: pom.xml . POM m2eclipse, , ( ). , .

, . - , ? m2eclipse, , , pom.xml( POM).

+5
1

m2eclipse , .. .

POM (, " POM" ).

+3

All Articles