-3

I need to use the plugin maven assembly from wrap one class of my application in a jar. when i use maven, the plugin assembly package all class in my package in target jar. how to specify the class i want to packaged in my jar.

1 Answers1

2

Do you have to use the maven assembly plugin? If you want to generate a jar file you could use the maven jar plugin instead.

It would be something like that:

<project>
  ...
  <build>
    <plugins>
      ...
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>2.4</version>
        <configuration>
          <includes>
            <include>com/company/project/package/SomeClass.class</include>
            <include>com/company/project/anotherpackage/AnotherClass.class</include>
          </includes>
        </configuration>
      </plugin>
      ...
    </plugins>
  </build>
  ...
</project>

The plugin can be executed in a common mvn package execution.

Filipe Fedalto
  • 2,540
  • 1
  • 18
  • 21