Ant / maven integration

I have a project that is built and managed by Maven. I have a second project with an ant construct. I would like to reference the maven project from the ant project and use all the necessary dependencies. Can anyone suggest a way to do this?

thanks,

Jeff

+3
source share
5 answers

maven-ant -tasks work well enough for this kind of thing.

+4
source

You can use Ivy :

maven Ant Ant, maven.

+2

Apache Ivy - Ant, Maven.

, .

+1

ant Mercury, , (, ), / ant . . .

Maven ant, . Maven Mercury ( Maven3), Mercury.

The following configuration reads the dependencies on the specified pom and populates the specified variable with the resulting path:

<path id="my.compile.path">
  <deps>
    <dependency name="groupId:artifactId:1.0::pom" 
        pom="${basedir}/artifactId-1.0.pom"/>
  </deps>
</path>

You can also use Mercury tasks to deploy to the Maven repository using the ant build file:

<repo id="myRepository" 
    url="http://localhost:8081/nexus/content/groups/public">
    <auth name="myUser" pass="myPassword"/>
</repo>

<write repoid="myRepository"
       name="my.group.id:my-artifact-id:1.0"
       file="${basedir}/target/my-artifact-id.jar"/>
+1
source

I talked in detail about how to do this:

Why you should use Maven Ant Tasks instead of Maven or Ivy .

0
source

Source: https://habr.com/ru/post/1716628/


All Articles