Maven的目标去哪儿了?

| 我正在使用Maven 3.0.3。我想编写一个简单的任务,将war文件从目标目录复制到Tomcat部署目录。我的目标放在哪里?我试过了 ...
<?xml version=\"1.0\" encoding=\"UTF-8\"?><project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">
  <modelVersion>4.0.0</modelVersion>
  <groupId>socialmediaproxy</groupId>
  <artifactId>socialmediaproxy</artifactId>
  <packaging>war</packaging>
  <version>0.1</version>

  <goal name=\"copy-war\" description=\"Copies the war file to the webapps directory\">
    <!-- This is Ant stuff -->
    <copy file=\"${basedir}/target/${artifactId}-${version}.war\" tofile=\"${warDestinationDir}\"/>
  </goal>
但是当我跑步时
mvn copy-war -P dev
我收到此错误... [错误]版本无法读取1个项目-> [帮助1] [错误] [错误]项目socialmediaproxy:socialmediaproxy:0.1(/Users/davea/Documents/workspace-sts-2.6.0.SR1/socialmediaproxy/pom.xml)有1个错误 [错误]格式错误的POM /Users/davea/Documents/workspace-sts-2.6.0.SR1/socialmediaproxy/pom.xml:无法识别的标记:\'goal \'(位置:START_TAG看到了... y-war \“说明= \“将war文件复制到webapps目录\”> ... @ 9:84)@ /Users/davea/Documents/workspace-sts-2.6.0.SR1/socialmediaproxy/pom.xml,第9行,列84-> [帮助2] 有任何想法吗? -戴夫     
已邀请:
您可以使用ANT本身将内容从目标目录复制到Tomcat Dir 由于您要从目标目录中移动文件,因此在打包阶段运行
ANTRUN
插件。
<artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
<phase>package</phase>
<configuration>
    <target>
        <copy file=\"${basedir}/target/${artifactId}-${version}.war\" tofile=\"${warDestinationDir}\"/>
    </target>
</configuration>
<goals>
<goal>run</goal>
在执行目标之后,将运行
<target>
中提到的ANT任务。              
pom中的目标部分已不存在,原因是来自Maven 1 ...但是您定义了一个供Maven 3使用的pom(模型版本4.0.0)。请看一下该pom的当前参考。 pom。     

要回复问题请先登录注册