Move bigjar with maven and Spring boot

2

When I develop a Big-jar with maven I move the jar from the target directory to a test directory using the following segment in the build:

        <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <configuration>
                <outputDirectory>../test</outputDirectory>
                <appendAssemblyId>false</appendAssemblyId>
                <descriptorRefs>
                    <descriptorRef>jar-with-dependencies</descriptorRef>
                </descriptorRefs>
                <archive>
                    <manifest>
                        <mainClass>cl.myapp.Main</mainClass>
                    </manifest>
                </archive>
            </configuration>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

But with Spring boot I should use the following plugin to package a big-jar

    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>

and in the boot plugin I have not found something similar to tag outputDirecory to move the generated jar

Maybe with a later task in Ant I could move the generated big-jar to my test directory?

    
asked by Kaltresian 16.07.2016 в 20:42
source

1 answer

1

I found a solution with a plugin that executes ANT tasks

    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>


        <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
                <execution>
                    <phase>package</phase>
                    <configuration>
                        <tasks>
                            <copy file="target/myapp.jar" tofile="../test/myapp.jar" />
                        </tasks>
                    </configuration>
                    <goals>
                        <goal>run</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>


    </plugins>
    
answered by 17.07.2016 в 00:32