'Automatically upload Maven compiled jar to FTP location?
I have a Java project that uses Maven and I work in IntelliJ.
My current work process to test the code on my testing server is:
- Run
installfrom the Maven window
- Using WinSCP to upload the compiled jar to the testing server.
I'm wondering if it's possible to add a custom task, like install and upload to the Maven toolbar in IntelliJ that executes install and then executes some code to upload the compiled jar via FTP.
Solution 1:[1]
The steps are pretty simple.
In your POM, inside the tag you can add:
<build>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ftp</artifactId>
<version>3.2.0</version>
</extension>
</extensions>
</build>
<distributionManagement>
<repository>
<id>Whatever_ID</id>
<url>ftp://your.ftp.url</url>
</repository>
</distributionManagement>
If you need a username and a password, you can add them in your /.m2/settings.xml:
<settings xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>Whatever_ID</id>
<username>YourUsername</username>
<password>YourPassword</password>
</server>
</servers>
</settings>
Then you can deploy using : mvn deploy
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | BaptisteM |

