Search code examples
mavenspring-boot-actuator

How to place output Jar and War files in another specified folder(it may be outside of the project)?


i want to place output jar or war in another separate folder which should contain only jar or war file. i.e folder may be outside of the project. is that possible?


Solution

  • Although generally it's not a good idea to deviate from Maven conventions, you can use outputDirectory parameter in maven-jar-plugin to specify a directory other than ${project.build.directory}

    <project>
      ...
      <build>
        <plugins>
          ...
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <version>3.1.0</version>
            <configuration>
              <outputDirectory>path/to/your/folder</outputDirectory>
            </configuration>
          </plugin>
          ...
        </plugins>
      </build>
      ...
    </project>