Copy executable jar after installation
I need to copy the executable jar to a network folder during the installation lifecycle. Now I am trying to add more detail to my problem. I am developing a java program using maven as build tool. After
Now I have created some profiles inside my pom and after installation I need to move my jar executable to a network directory. For example, I hava:
- My jar file in target / myJar.jar
- The network folder is located at \ 192.168.0.11 \ export \ jars
For this I am using maven-upload-plugin with the following configuration:
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-upload-plugin</artifactId>
<version>1.1</version>
<configuration>
<serverId>MyServer</serverId>
<resourceSrc>${project.build.directory}\${project.build.finalName}.${project.packaging}</resourceSrc>
<resourceDest>/home/export/jars</resourceDest>
<url>\\192.168.0.11\export\jars</url>
</configuration>
</plugin>
I cannot find much documentation about this plugin and I would like some information about resources, resource, resource, url.
Where I run the mvn upload: upload -P Production command, I get anything copied to my remote folder.
Where am I doing wrong?
source to share
Since you are using the maven-upload-plugin so according to the doc it should be something like this
<url>file://192.168.0.11/export/jars</url>
but here is another post with some success
If you can try another plugin, there is another solution here with another plugin which is more common
<profiles>
<profile>
<id>publish</id>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>ftp</id>
<phase>install</phase>
<configuration>
<tasks>
<ftp action="send"
server="${ftp.host}" remotedir="${ftp.remotedir}"
userid="${ftp.userid}" password="${ftp.password}"
depends="${ftp.depends}" verbose="${ftp.verbose}">
<fileset dir="${project.build.directory}">
<include
name="${project.build.finalName}.${project.packaging}"/>
</fileset>
</ftp>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
<version>1.4.1</version>
</dependency>
<dependency>
<groupId>ant</groupId>
<artifactId>ant-commons-net</artifactId>
<version>1.6.5</version>
</dependency>
<dependency>
<groupId>ant</groupId>
<artifactId>ant-nodeps</artifactId>
<version>1.6.5</version>
</dependency>
</dependencies>
</plugin>
<properties>
<ftp.host>hostname</ftp.host>
<ftp.remotedir>/opt/path/to/install</ftp.remotedir>
<ftp.userid>user</ftp.userid>
<ftp.password>mypassword</ftp.password>
<ftp.depends>yes</ftp.depends>
<ftp.verbose>no</ftp.verbose>
</properties>
</profile>
</profiles>
source to share