0

自分のサイトを自分の ftp サーバーに直接アップロードしたいと考えています。pom.xml を設定しようとしていますが、プラグインに問題があります。私はオンラインで多くのガイドを読みましたが、どれもユニークではなく、少なくとも大きな違いがあります. コツやコツはありますか?

<profile>
  <id>deploy</id>
  <build>
    <plugins>
      <plugin>
        <inherited>false</inherited>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <version>1.6</version>
        <configuration>
          <target>
            <ftp action="send" server="server"
              remotedir="/a/b" userid="usr"
              password="pw" depends="no"
              verbose="yes" binary="yes">
              <fileset dir="modules/my-module/target">
                <include name="my-static-file.zip" />
              </fileset>
            </ftp>
            <taskdef name="ftp"              classname="org.apache.tools.ant.taskdefs.optional.net.FTP"
              classpathref="maven.plugin.classpath" />
          </target>
        </configuration>
        <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-jsch</artifactId>
            <version>1.6.5</version>
          </dependency>
          <dependency>
            <groupId>jsch</groupId>
            <artifactId>jsch</artifactId>
            <version>0.1.29</version>
          </dependency>
        </dependencies>
      </plugin>
    </plugins>
  </build>
</profile>
4

2 に答える 2

0

maven-antrun-plugin の代わりに、 maven-wagon-pluginのアップロード ゴールを使用することをお勧めします。これは、複数のファイルを ftp にアップロードするデモ プロジェクトの例です

于 2012-05-31T19:04:26.997 に答える
0

これが私の pom.xml です。

<build>
  <extensions>
    <extension>
       <groupId>org.apache.maven.wagon</groupId>
       <artifactId>wagon-ftp</artifactId>
       <version>2.2</version>
     </extension>
   </extensions>
      <defaultGoal>package</defaultGoal>
    <plugins>
      <plugin>
        <artifactId>maven-war-plugin</artifactId>
      </plugin>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.6</source>
          <target>1.6</target>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>wagon-maven-plugin</artifactId>
        <version>1.0-beta-4</version>
        <configuration>
         <skip>false</skip>
          <serverId>ftpserver</serverId>
          <url>ftp://---.---.----.---/var/www/html</url>
        </configuration>
        <executions>
          <execution>
            <id>upload</id>
            <phase>deploy</phase>
            <goals>
              <goal>upload</goal>
            </goals>
            <configuration>
              <fromDir>${project.basedir}/target/${project.artifactId}-${project.version}/</fromDir>
              <includes>*</includes>
              <toDir></toDir>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

Run As -> Maven Install を使用すると Eclipse 3.7 を使用していますが、すべてを ftp サーバーにアップロードするために展開フェーズを開始したいと考えています。Eclipse の構成方法 私のPOMは今、このタスクに適していますか?

于 2012-06-09T16:38:59.803 に答える