views:

994

answers:

1

Hi,

I am using Maven2 and would like to deploy my generated site to a web server using ftp.

i tried to use:

<distributionManagement>
    <site>
     <id>website</id>
     <url>ftp://host/pub/</url>
    </site>

</distributionManagement>

the problem is that get an error that ftp is not supported. could it be that this basic feature doesn't work.

Thanks,

Ronen.

+3  A: 

As I misinterpreted your intention the first time. Here the right solution:

Deploy site via ftp-server

<project>
  [...]
  <distributionManagement>
    <repository>
      <id>ftpserver</id>
      <name>some ftpserver name</name>
      <url>ftp://host/pub</url>
    </repository>
  </distributionManagement>
  <build>
    <extensions>
      <!-- uncomment this one if you use maven < 2.1.0 -->
      <!-- and want to copy directories too :) -->
      <!--
      <extension>
        <groupId>org.mod4j.patched</groupId>
        <artifactId>wagon-ftp</artifactId>
        <version>1.0-beta-2-PATCHEDv3-WAGON-148</version>
      </extension>
      -->

      <!-- uncomment this one (or next) if you use maven >= 2.1.0  -->
      <!--
      <extension>
        <groupId>org.mod4j.patched</groupId>
        <artifactId>wagon-ftp</artifactId>
        <version>1.0-beta-5-PATCHED-v1</version>
      </extension>
      -->
      <!-- i guess you could also use this one instead of the -->
      <!-- org.mod4j.patched version too, but maybe they patched -->
      <!-- something substantial here too in regrad to the apache version -->
      <!--
      <extension>
        <groupId>org.apache.maven.wagon</groupId>
        <artifactId>wagon-ftp</artifactId>
        <version>1.0-beta-5</version>
      </extension>
      -->

      <!-- don't uncomment this one, even if you use maven < 2.1.0. -->
      <!-- except the you don't want to be able to copy directories -->
      <!-- and you know you want too :-) (why would you?) -->
      <!--
      <extension>
        <groupId>org.apache.maven.wagon</groupId>
        <artifactId>wagon-ftp</artifactId>
        <version>1.0-beta-2</version>
      </extension>
      -->
    </extensions>
  </build>
  [...]
</project>

And in your settings.xml you will need

<settings>
  ...
  <servers>
    <server>
      <id>ftpserver</id>
      <username>user</username>
      <password>pass</password>
    </server>
  </servers>
  ...
</settings>
jitter
I tried this. I get the following: [FATAL ERROR] org.apache.maven.plugins.site.SiteDeployMojo#execute() caused a linkage error (java.lang.AbstractMethodError) and may be out-of-date. Ch eck the realms: [FATAL ERROR] Plugin realm = app0.child-container[org.apache.maven.plugins:maven-site-plugin] I also need to deploy site - site plugin and not deploy artifact - deploy plugin
rperez
updated answer, this time with correct answer to deploy site (not artifact) via ftp
jitter
Thanks a lot. it worked.I chose to use 1.0-beta-5-PATCHED-v1.I wonder how come this is not inherent in maven-site-plugin as the maven site lifecycle declare the site-deploy phasethanks again
rperez
You are still using the maven-site-plugin, only the needed wagon for ftp has to be specified explicitly. Check http://maven.apache.org/wagon/
jitter