Upload file via Ant FTP task in Maven

前端 未结 3 1457
时光说笑
时光说笑 2021-01-12 16:10

I\'m trying to upload a file using an Ant task. If I use Ant directly the file is uploaded, but if I call the ant task via Maven (using the maven-antrun-plugin)

3条回答
  •  孤独总比滥情好
    2021-01-12 16:46

    As Pascal has mentioned, the maven-antrun-plugin is not using the ant specified by your $ANT_HOME environment variable, and the configuration that he's mentioned is probably the best way to do it consistently from a pure maven perspective.

    However, the jar can be stored in $USER_HOME/.ant/lib instead of $ANT_HOME/lib, these jars should be available on the classpath for any instance of ant that is run by that user.

    Note that your ant script cannot assume that the jars are present, and that the jars are only placed on the classpath at startup, so if the script defines a setup target to download the jars into $USER_HOME/.ant/lib, then this target would have to be run in a "separate-ant-session", before and is invoked again to execute the task that depends on the jar.

    The only potential benefit that you may derive from this approach is that the Ant script may be runnable from maven and Ant.

提交回复
热议问题