Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert build.xml to maven pom file?

Tags:

maven

ant

I have a portlet project which runs using build.xml. I want to shift to maven-based build management.

  1. How can I map build.xml to pom.xml?

  2. How can I write a goal for every target in build.xml?

  3. Is it a good idea to use maven maven-antrun-plugin-1.6 for running ant tasks from pom.xml or not?

  4. How can I put jars from the build path to repository?

like image 663
user89749 Avatar asked Aug 10 '11 07:08

user89749


People also ask

Is build xml and POM xml same?

A POM does not relate to a build. xml file, just as much as Maven does not relate to Ant. However, if you integrate Ivy into your Ant environment you can convert the POM to an ivy. xml file with the convertpom task.


1 Answers

  1. You simply can't because Maven has a build life-cycle

  2. You have to understand that Maven has a build life-cycle and that is your plan. You must forget the Ant Targets.

    The lifecycle has for example test-compile (compile the unit tests) and compile (compiling your production code. And further steps are running the unit tests and finally packaging your production code into a jar file.

  3. It's not a good idea to use maven-antrun-plugin (only in very very very very rare cases).

  4. Via mvn release:prepare release:perform or via mvn deploy (for SNAPSHOTs)

I recommend reading Books about Maven in particular Maven by Example and Maven: The Complete Reference

If you are working for a company you should think hard about setting up a repository manager (for example Nexus or Archiva etc.).

like image 84
khmarbaise Avatar answered Sep 30 '22 16:09

khmarbaise