1

I build my project with mvn clean install, however I want to generate a subfolder in the target folder and put the generated jar file in there. I saw these two questions Maven: specify the outputDirectory only for packaging a jar? and maven: how to place the output jar into another folder however their answer doesn't seem to work.

This is how my maven build looks like:

   <build>
        <plugins>       
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-jar-plugin</artifactId>
              <version>2.3.1</version>
              <configuration>
                <outputDirectory>${project.build.directory}/blah</outputDirectory>
              </configuration>
            </plugin>
        </plugins>
    </build>

However I get the .jar file still in target directory. I also noticed that the project packaging is set as <packaging>eclipse-plugin</packaging> if I change this to jar, then it works fine, however I do need it to be eclipse-plugin. I am also using tycho for the eclipse plugin. Am I missing something that was not mentioned before?

Community
  • 1
  • 1
Sarp Kaya
  • 3,686
  • 21
  • 64
  • 103

1 Answers1

1

From your packaging of eclipse-plugin I'm guessing you're using Tycho. Tycho doesn't seem to use any of the maven plugins, so configuring the maven-jar-plugin isn't going to help. Instead try configuring the tycho-packaging-plugin, specifically the buildDirectory property:

<plugin>
  <groupId>org.eclipse.tycho</groupId>
  <artifactId>tycho-packaging-plugin</artifactId>
  <version>${tycho-version}</version>
  <configuration>
    <buildDirectory>${project.build.directory}/blah</buildDirectory>
  </configuration>
</plugin>
Glorfindel
  • 21,988
  • 13
  • 81
  • 109
1337joe
  • 2,327
  • 1
  • 20
  • 25