This works well, except I dont want this:
[INFO] Installing /home/peter/workspace/SDCP/target/sdcp.jar to
/home/peter/.m2/repository/com/howudodat/sdcp/1.0-SNAPSHOT/sdcp-1.0-SNAPSHOT.jar
[INFO] Installing /home/peter/workspace/SDCP/pom.xml to
/home/peter/.m2/repository/com/howudodat/sdcp/1.0-SNAPSHOT/sdcp-1.0-SNAPSHOT.pom
I dont really want my application jar to be installed in my local repo
there is:
<configuration>
<skip>true</skip>
</configuration>
but I'm guessing that's to skip the entire phase
Peter
On 10/31/23 09:00, Delany wrote:
Hi Peter,
Firstly, compile and package are part of the same lifecycle (the default
lifecycle), so its not necessary to specify both.
Then you can add this profile to your pom so you don't have to run the
dependency plugin separately.
<profile>
<id>dispatch</id>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-artefacts</id>
<phase>install</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
<type>${project.packaging}</type>
</artifactItem>
</artifactItems>
<outputDirectory>/mnt/remote_app/</outputDirectory>
</configuration>
</execution>
<execution>
<id>copy-dependencies</id>
<phase>install</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>/mnt/remote_app/libs/</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
<excludeTransitive>true</excludeTransitive>
<includeScope>runtime</includeScope>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
Build with `mvn clean install -Pdispatch`
Regards,
Delany
On Tue, 31 Oct 2023 at 17:33, Peter Carlson<pe...@howudodat.com> wrote:
I currently use the below commands to prepare my java application:
mvn clean compile package dependency:copy-dependencies
Then I manually copy the files with:
cp target/myapp-1.0-SNAPSHOT.jar /mnt/remote_app/myapp.jar
cp target/dependency/* /mnt/remote_app/libs/
I'm wondering:
1) what plugin would be best to do the copy command for me?
2) is there a single command I can do to perform all the tasks above?
Peter