You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by asdas adasads <ze...@gmail.com> on 2010/11/09 00:58:44 UTC

Using maven with ant.

Hi

    In my current project I try to use maven as wrapper to ant. On each
phase (clean, test, compile, package) I use exec-maven-plugin and execute
counterpart ant command i.e. ant clean or ant test etc. The problem is the
install phase. Ant creates three jars (in \build directory) called a.jar,
b.jar, c.jar. Unfortunately maven disregards them, creates an empty jar in
\target directory and installs it to the local repository. Is there any way
to inform maven that it should try to install a.jar, b.jar, c.jar ?

Best

john

Re: Using maven with ant.

Posted by Justin Edelson <ju...@gmail.com>.

On Nov 8, 2010, at 10:34 PM, asdas adasads <ze...@gmail.com> wrote:

> I would prefer Maven rather than Ivy. If I will add Maven to the project
> maybe it will be a starting point and in future I will migrate to maven
> fully.
> 
> Then use the Maven Ant Tasks.
> 
> 
> Ok. But my initial question was: How to force maven to deploy jars created
> during ant build to the remote repository.
> Example:
> 
>    I have jar a.jar, b.jar, c.jar in \build dir and I want to deploy them
> remote repository. Normally maven tries to deploy only one jar
> that he finds in \targer\artificate_name.jar. How Maven Ant Tasks is going
> to help with that ?
> 
http://maven.apache.org/ant-tasks/examples/install-deploy.html


> john
> 
> 
> On Mon, Nov 8, 2010 at 5:50 PM, Justin Edelson <ju...@justinedelson.com>wrote:
> 
>> 
>> 
>> On 11/8/10 8:33 PM, "asdas adasads" <ze...@gmail.com> wrote:
>> 
>>>> 
>>>> Why are you even trying to use Maven if you end up using Ant for
>>>> everything?
>>> 
>>> 
>>> To be honest only to be able to automatically push software to the remote
>>> repository.
>> 
>> Then use the Maven Ant Tasks.
>> 
>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>> 
>> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Using maven with ant.

Posted by vijendra <vj...@gmail.com>.
I divide this into 2 parts first. Working on this issue for quite sometime
now.

1) Maven in my case is able to deploy/publish to repository/artifactory the
only .jar defined in pom file.
After that it simply ignores. if written inside ant build or not.
I have merged entire ant build code inside pom file to get my thing working,
as classpath issues were kiiling me and normally ant doesn't even supprt
publioshing to artifactory.


2) In case u are able to deploy to repository using ant, then here is the
simple solution what i did.
using antrun plugin in your pom file call your ant build inside
anttasks(target now; as tasks is deprecated).
For classpath issues look into maven-dependency-plugin. here you can
configure, to copy maven dependencies into a folder without ant being
involved at all.

Hope this helps.

--
View this message in context: http://maven.40175.n5.nabble.com/Using-maven-with-ant-tp3256022p4498369.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Using maven with ant.

Posted by asdas adasads <ze...@gmail.com>.
I would prefer Maven rather than Ivy. If I will add Maven to the project
maybe it will be a starting point and in future I will migrate to maven
fully.

Then use the Maven Ant Tasks.


Ok. But my initial question was: How to force maven to deploy jars created
during ant build to the remote repository.
Example:

    I have jar a.jar, b.jar, c.jar in \build dir and I want to deploy them
remote repository. Normally maven tries to deploy only one jar
that he finds in \targer\artificate_name.jar. How Maven Ant Tasks is going
to help with that ?

john


On Mon, Nov 8, 2010 at 5:50 PM, Justin Edelson <ju...@justinedelson.com>wrote:

>
>
> On 11/8/10 8:33 PM, "asdas adasads" <ze...@gmail.com> wrote:
>
> >>
> >>Why are you even trying to use Maven if you end up using Ant for
> >>everything?
> >
> >
> >To be honest only to be able to automatically push software to the remote
> >repository.
>
> Then use the Maven Ant Tasks.
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Using maven with ant.

Posted by Justin Edelson <ju...@justinedelson.com>.

On 11/8/10 8:33 PM, "asdas adasads" <ze...@gmail.com> wrote:

>>
>>Why are you even trying to use Maven if you end up using Ant for
>>everything?
>
>
>To be honest only to be able to automatically push software to the remote
>repository.

Then use the Maven Ant Tasks.




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Using maven with ant.

Posted by asdas adasads <ze...@gmail.com>.
>
> Why are you even trying to use Maven if you end up using Ant for
> everything?


To be honest only to be able to automatically push software to the remote
repository.
I'm developing a library that is used by external projects that use maven in
their build.
I wanted to avoid sending them jars (that might become obsolete over time)
and I would prefer
to be able to deploy my library to remote repository.

Try using antrun, instead of exec to call ant..


It didn't work, when using antrun maven didn't set the same classpath as I
would get when executing ant from
command line. In general from antrun I would call targets from my build.xml
so it is not a big difference whether I use
antrun or exec.

 What parts of your build make it complicated?


    I use some strange classpath manipulations during testing period, also I
have a lot of properties file.
In general ant works perfectly fine for me so I don't want mess things that
works correctly. Especially that I'm not author
of the code and I'm not 100% sure about it's features.

john


On Mon, Nov 8, 2010 at 5:20 PM, Greg Akins <an...@gmail.com> wrote:

> Why are you even trying to use Maven if you end up using Ant for
> everything?
>
> Try using antrun, instead of exec to call ant..
>
> When I migrated a number of projects from Ant to Maven, I began by
> pulling pieces of each project out.  My 5 Ant projects turned into
> about 10 Maven projects.
>
> What parts of your build make it complicated?
>
> On Mon, Nov 8, 2010 at 7:43 PM, asdas adasads
> <ze...@gmail.com> wrote:
> > I was expecting that kind of answer :)
> >
> > But, the problem is that we have too complicated build process to migrate
> it
> > to maven.
> > Supporting basic operations(clean, test,compile, package) required only
> few
> > lines in the pom file so I was
> > thinking that supporting install/deploy will be the same. Is there any
> > website (I did research before writing this post)
> > that talks about custom install process ?
> >
> > john
> >
> >
> > On Mon, Nov 8, 2010 at 4:16 PM, Ron Wheeler
> > <rw...@artifact-software.com>wrote:
> >
> >> On 08/11/2010 6:58 PM, asdas adasads wrote:
> >>
> >>> Hi
> >>>
> >>>     In my current project I try to use maven as wrapper to ant. On each
> >>> phase (clean, test, compile, package) I use exec-maven-plugin and
> execute
> >>> counterpart ant command i.e. ant clean or ant test etc. The problem is
> the
> >>> install phase. Ant creates three jars (in \build directory) called
> a.jar,
> >>> b.jar, c.jar. Unfortunately maven disregards them, creates an empty jar
> in
> >>> \target directory and installs it to the local repository. Is there any
> >>> way
> >>> to inform maven that it should try to install a.jar, b.jar, c.jar ?
> >>>
> >>> Best
> >>>
> >>> john
> >>>
> >>>  Get rid of Ant and get your build working with Maven.
> >>
> >> Or get rid of Maven and just use ANT.
> >>
> >> Mixing the 2 is just going to drive you crazy and generate lots of
> traffic
> >> here for no real advantage.
> >>
> >> Ron
> >>
> >>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >> For additional commands, e-mail: users-help@maven.apache.org
> >>
> >>
> >
>
>
>
> --
> Greg Akins
>
> http://insomnia-consulting.org
> http://www.pghcodingdojo.org
> http://pittjug.dev.java.net
> http://twitter.com/akinsgre
> http://www.linkedin.com/in/akinsgre
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Using maven with ant.

Posted by Greg Akins <an...@gmail.com>.
Why are you even trying to use Maven if you end up using Ant for everything?

Try using antrun, instead of exec to call ant..

When I migrated a number of projects from Ant to Maven, I began by
pulling pieces of each project out.  My 5 Ant projects turned into
about 10 Maven projects.

What parts of your build make it complicated?

On Mon, Nov 8, 2010 at 7:43 PM, asdas adasads
<ze...@gmail.com> wrote:
> I was expecting that kind of answer :)
>
> But, the problem is that we have too complicated build process to migrate it
> to maven.
> Supporting basic operations(clean, test,compile, package) required only few
> lines in the pom file so I was
> thinking that supporting install/deploy will be the same. Is there any
> website (I did research before writing this post)
> that talks about custom install process ?
>
> john
>
>
> On Mon, Nov 8, 2010 at 4:16 PM, Ron Wheeler
> <rw...@artifact-software.com>wrote:
>
>> On 08/11/2010 6:58 PM, asdas adasads wrote:
>>
>>> Hi
>>>
>>>     In my current project I try to use maven as wrapper to ant. On each
>>> phase (clean, test, compile, package) I use exec-maven-plugin and execute
>>> counterpart ant command i.e. ant clean or ant test etc. The problem is the
>>> install phase. Ant creates three jars (in \build directory) called a.jar,
>>> b.jar, c.jar. Unfortunately maven disregards them, creates an empty jar in
>>> \target directory and installs it to the local repository. Is there any
>>> way
>>> to inform maven that it should try to install a.jar, b.jar, c.jar ?
>>>
>>> Best
>>>
>>> john
>>>
>>>  Get rid of Ant and get your build working with Maven.
>>
>> Or get rid of Maven and just use ANT.
>>
>> Mixing the 2 is just going to drive you crazy and generate lots of traffic
>> here for no real advantage.
>>
>> Ron
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>



-- 
Greg Akins

http://insomnia-consulting.org
http://www.pghcodingdojo.org
http://pittjug.dev.java.net
http://twitter.com/akinsgre
http://www.linkedin.com/in/akinsgre

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Using maven with ant.

Posted by asdas adasads <ze...@gmail.com>.
I was expecting that kind of answer :)

But, the problem is that we have too complicated build process to migrate it
to maven.
Supporting basic operations(clean, test,compile, package) required only few
lines in the pom file so I was
thinking that supporting install/deploy will be the same. Is there any
website (I did research before writing this post)
that talks about custom install process ?

john


On Mon, Nov 8, 2010 at 4:16 PM, Ron Wheeler
<rw...@artifact-software.com>wrote:

> On 08/11/2010 6:58 PM, asdas adasads wrote:
>
>> Hi
>>
>>     In my current project I try to use maven as wrapper to ant. On each
>> phase (clean, test, compile, package) I use exec-maven-plugin and execute
>> counterpart ant command i.e. ant clean or ant test etc. The problem is the
>> install phase. Ant creates three jars (in \build directory) called a.jar,
>> b.jar, c.jar. Unfortunately maven disregards them, creates an empty jar in
>> \target directory and installs it to the local repository. Is there any
>> way
>> to inform maven that it should try to install a.jar, b.jar, c.jar ?
>>
>> Best
>>
>> john
>>
>>  Get rid of Ant and get your build working with Maven.
>
> Or get rid of Maven and just use ANT.
>
> Mixing the 2 is just going to drive you crazy and generate lots of traffic
> here for no real advantage.
>
> Ron
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Using maven with ant.

Posted by Ron Wheeler <rw...@artifact-software.com>.
On 08/11/2010 6:58 PM, asdas adasads wrote:
> Hi
>
>      In my current project I try to use maven as wrapper to ant. On each
> phase (clean, test, compile, package) I use exec-maven-plugin and execute
> counterpart ant command i.e. ant clean or ant test etc. The problem is the
> install phase. Ant creates three jars (in \build directory) called a.jar,
> b.jar, c.jar. Unfortunately maven disregards them, creates an empty jar in
> \target directory and installs it to the local repository. Is there any way
> to inform maven that it should try to install a.jar, b.jar, c.jar ?
>
> Best
>
> john
>
Get rid of Ant and get your build working with Maven.

Or get rid of Maven and just use ANT.

Mixing the 2 is just going to drive you crazy and generate lots of 
traffic here for no real advantage.

Ron




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org