Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where do maven goals go?

Tags:

maven

maven-3

I'm using Maven 3.0.3. I want to write a simple task to copy a war file from my target directory to the Tomcat deploy directory. Where do I put my goal? I tried ...

<?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>

but when I run

mvn copy-war -P dev

I get this error ...

[ERROR] The build could not read 1 project -> [Help 1] [ERROR]
[ERROR] The project socialmediaproxy:socialmediaproxy:0.1 (/Users/davea/Documents/workspace-sts-2.6.0.SR1/socialmediaproxy/pom.xml) has 1 error [ERROR] Malformed POM /Users/davea/Documents/workspace-sts-2.6.0.SR1/socialmediaproxy/pom.xml: Unrecognised tag: 'goal' (position: START_TAG seen ...y-war" description="Copies the war file to the webapps directory">... @9:84) @ /Users/davea/Documents/workspace-sts-2.6.0.SR1/socialmediaproxy/pom.xml, line 9, column 84 -> [Help 2]

Any ideas? - Dave

like image 895
Dave Avatar asked Nov 27 '25 09:11

Dave


1 Answers

The goal part in the pom does not exist anymore, cause that's from Maven 1...but you defined a pom (model version 4.0.0) which is intended for Maven 3. Take a look into the current reference for the pom.

like image 138
khmarbaise Avatar answered Nov 28 '25 22:11

khmarbaise



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!