0

I am using the onejar-maven-plugin to generate the jar for my project and it all goes well. But, when I try to change it to a sub-folder, for eg. dist, the jar from maven-jar-plugin gets generated, not the jar from onejar.

The onejar plugin does not have an output directory option.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-jar-plugin</artifactId>
    <configuration>
        <outputDirectory>${project.build.directory}/dist</outputDirectory>
        <archive>
            <manifest>
                <mainClass>com.ss.itempriceclient.ItemPriceUploader</mainClass>
            </manifest>
        </archive>
    </configuration>
</plugin>
<plugin>
    <groupId>org.dstovall</groupId>
    <artifactId>onejar-maven-plugin</artifactId>
    <version>1.4.4</version>
    <executions>
        <execution>
            <configuration>
                <classifier>onejar</classifier>
            </configuration>
            <goals>
                <goal>one-jar</goal>
            </goals>
        </execution>
    </executions>
</plugin>

How do I change the output directory of the onejar generated file to a subfolder, eg. dist?

  • Why do you need to change the folder inside target folder? Why defining a outputDirectory for maven-jar-plugin? If you like to create a single jar which contains all dependencies just take a look at maven-assembly-plugin which handles this. – khmarbaise Nov 01 '14 at 20:33
  • Thats what I finally did. I think this question can be closed. – Parikshit Iyengar Nov 17 '14 at 09:11

1 Answers1

0

I finally went with maven-assembly-plugin. Has lots of configuration options.