maven: Deploying .jar to remote Maven repository by ftp

	<build>
		<plugins>
                        <!-- other plugins, skipped -->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-deploy-plugin</artifactId>
				<version>2.8.2</version>
			</plugin>
		</plugins>
 
		<extensions>
			<!-- Enabling the use of FTP -->
			<extension>
				<groupId>org.apache.maven.wagon</groupId>
         		<artifactId>wagon-ftp</artifactId>
         		<version>1.0-beta-6</version>
			</extension>
		</extensions>
	</build>
 
	<distributionManagement>
		<repository>
			<id>repo-server</id>
			<url>ftp://192.168.1.253/var/maven</url>
		</repository>
	</distributionManagement>

~/.m2/settings.xml – need login/pass

	<settings>
		<servers>
			<server>
				<id>repo-server</id>
				<username>maven</username>
				<password>***</password>
			</server>
		</servers>
	</settings>

On server (need active ftp daemon working with local user login/passwords):
$ useradd -m maven
$ passwd maven
$ mkdir /var/maven
$ chown -R maven:maven /var/maven

Leave a Reply

Your email address will not be published. Required fields are marked *