你能对你遇到的问题再具体一点吗?你有什么错误吗?
我已经在我的
pom.xml
,在一个
antrun
<configuration>
而且效果很好:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
...
<ftp server="${my-ftp-url}" userid="${ftp-${appli}-${env}-username}" password="${ftp-${appli}-${env}-password}"
remotedir="${remoteDir}/sources" passive="yes">
<fileset dir="../target/">
<include name="*.tar.gz"/>
</fileset>
</ftp>
...
正如您在这个代码片段中看到的,我使用
${ftp-${appli}-${env}-username}
财产,其中
${appli}
,
${env}
和
${ftp-xxx-yyy-username}
settings.xml
不管怎样,正如尤金·库莱索夫建议的那样,我要买一套
<profiles>
那个
定义一些属性,使用
<properties>
<build>
<plugins>
<!-- Properties loader -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-1</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>${basedir}/${env-properties-file}</file>
</files>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
...
<profiles>
<!-- Development -->
<profile>
<id>dev</id>
<activation>
<activeByDefault>true</activeByDefault>
<property>
<name>env</name>
<value>dev</value>
</property>
</activation>
<properties>
<env-properties-file>dev-environment.properties</env-properties-file>
</properties>
</profile>
<!-- Homologation -->
<profile>
<id>hom</id>
<activation>
<activeByDefault>false</activeByDefault>
<property>
<name>env</name>
<value>hom</value>
</property>
</activation>
<properties>
<env-properties-file>homologation-environment.properties</env-properties-file>
</properties>
</profile>
...