You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Vijay Venkataraman <vi...@gmail.com> on 2009/12/02 07:06:32 UTC

Running ANT task before pulling down dependencies

Hi,
Currently i am trying to get maven project setup which creates a jar
artifact. I have setup the project structure.
Unfortunately i we don't have the libraries in central repository as per
maven layout and jars don't have version numbers.
They are jars like product1.jar, product2.jar. These jars are the project
dependencies.
I was thinking of running ant task which will move the jars to necessary
location and rename the jars during validate phase. After which i expect the
compile to execute.

But i see that dependency resolution happens first before any tasks can be
executed. Is it that i should write a separate ant script to do this before
running maven.
I am using maven 2.1.0.

Is there a better way to accomplish this?

Thanks,
Vijay

Re: Running ANT task before pulling down dependencies

Posted by Stephen Connolly <st...@gmail.com>.
Golder rule of build scripts: If they are not broken, don't fix them

Now if you want to refactor your build scripts from ANT to Maven
(which IMHO is a good thing) here is what I would recommend:

1. Set up a Maven Repository Manager (I use nexus, but there are
others, e.g. artifactory)

2. Start by adding Maven ANT Tasks to your ANT builds scripts.

2.1 Add an <artifact:deploy> to deploy your artifacts to the Maven
Repository Manager.
2.2 New projects can use Maven.
2.3 Stop using the "big bag of jars" lib folder concept and pull down
the intra-project artifacts from the MRM in the ANT build scripts

3. Take the ANT projects one at a time and convert to Maven
projects... if you do this slowly, you can probably keep the ANT build
script working in parallel.

Once you have passed step 2.1 above, you are free to mavenize projects
at leasure

HTH

-Stephen

2009/12/2 Vijay Venkataraman <vi...@gmail.com>:
> Hi Anders
>
> You are right. Unfortunately all the product builds are ant builds and there
> is no central repository concept which holds the artifacts in the way that
> is prescribed by maven. Again i cannot change all those pieces one shot. I
> want to try this out on one project and then slowly work on moving other
> pieces one by one.
>
> Thanks,
> Vijay
>
> On Tue, Dec 1, 2009 at 11:21 PM, Anders Hammar <an...@hammar.net> wrote:
>
>> Any reason why you're trying to build your own solution instead of going
>> the
>> Maven way by setting up a corporate repository populated with these
>> artifacts? Not only would it be the right solution, my guess is that it
>> would be so much easier than going against Maven.
>>
>> /Anders
>>
>> On Wed, Dec 2, 2009 at 07:06, Vijay Venkataraman <
>> vijay.venkataraman@gmail.com> wrote:
>>
>> > Hi,
>> > Currently i am trying to get maven project setup which creates a jar
>> > artifact. I have setup the project structure.
>> > Unfortunately i we don't have the libraries in central repository as per
>> > maven layout and jars don't have version numbers.
>> > They are jars like product1.jar, product2.jar. These jars are the project
>> > dependencies.
>> > I was thinking of running ant task which will move the jars to necessary
>> > location and rename the jars during validate phase. After which i expect
>> > the
>> > compile to execute.
>> >
>> > But i see that dependency resolution happens first before any tasks can
>> be
>> > executed. Is it that i should write a separate ant script to do this
>> before
>> > running maven.
>> > I am using maven 2.1.0.
>> >
>> > Is there a better way to accomplish this?
>> >
>> > Thanks,
>> > Vijay
>> >
>>
>

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


Re: Running ANT task before pulling down dependencies

Posted by Anders Hammar <an...@hammar.net>.
Well, set up a repository manager for your project then. Setting up Nexus
shouldn't take more than half a day and it doesn't require a super computer.
Then deploy the artifacts there.
As stated in many threads by many people, if you fight Maven you'll just be
sorry and likely you'd be better off staying with your old build tool. On
the other hand, if you just put a little extra effort into doing things the
Maven way you'll be greatly rewarded. :-)

/Anders

On Wed, Dec 2, 2009 at 09:21, Vijay Venkataraman <
vijay.venkataraman@gmail.com> wrote:

> Hi Anders
>
> You are right. Unfortunately all the product builds are ant builds and
> there
> is no central repository concept which holds the artifacts in the way that
> is prescribed by maven. Again i cannot change all those pieces one shot. I
> want to try this out on one project and then slowly work on moving other
> pieces one by one.
>
> Thanks,
> Vijay
>
> On Tue, Dec 1, 2009 at 11:21 PM, Anders Hammar <an...@hammar.net> wrote:
>
> > Any reason why you're trying to build your own solution instead of going
> > the
> > Maven way by setting up a corporate repository populated with these
> > artifacts? Not only would it be the right solution, my guess is that it
> > would be so much easier than going against Maven.
> >
> > /Anders
> >
> > On Wed, Dec 2, 2009 at 07:06, Vijay Venkataraman <
> > vijay.venkataraman@gmail.com> wrote:
> >
> > > Hi,
> > > Currently i am trying to get maven project setup which creates a jar
> > > artifact. I have setup the project structure.
> > > Unfortunately i we don't have the libraries in central repository as
> per
> > > maven layout and jars don't have version numbers.
> > > They are jars like product1.jar, product2.jar. These jars are the
> project
> > > dependencies.
> > > I was thinking of running ant task which will move the jars to
> necessary
> > > location and rename the jars during validate phase. After which i
> expect
> > > the
> > > compile to execute.
> > >
> > > But i see that dependency resolution happens first before any tasks can
> > be
> > > executed. Is it that i should write a separate ant script to do this
> > before
> > > running maven.
> > > I am using maven 2.1.0.
> > >
> > > Is there a better way to accomplish this?
> > >
> > > Thanks,
> > > Vijay
> > >
> >
>

Re: Running ANT task before pulling down dependencies

Posted by Vijay Venkataraman <vi...@gmail.com>.
Hi Anders

You are right. Unfortunately all the product builds are ant builds and there
is no central repository concept which holds the artifacts in the way that
is prescribed by maven. Again i cannot change all those pieces one shot. I
want to try this out on one project and then slowly work on moving other
pieces one by one.

Thanks,
Vijay

On Tue, Dec 1, 2009 at 11:21 PM, Anders Hammar <an...@hammar.net> wrote:

> Any reason why you're trying to build your own solution instead of going
> the
> Maven way by setting up a corporate repository populated with these
> artifacts? Not only would it be the right solution, my guess is that it
> would be so much easier than going against Maven.
>
> /Anders
>
> On Wed, Dec 2, 2009 at 07:06, Vijay Venkataraman <
> vijay.venkataraman@gmail.com> wrote:
>
> > Hi,
> > Currently i am trying to get maven project setup which creates a jar
> > artifact. I have setup the project structure.
> > Unfortunately i we don't have the libraries in central repository as per
> > maven layout and jars don't have version numbers.
> > They are jars like product1.jar, product2.jar. These jars are the project
> > dependencies.
> > I was thinking of running ant task which will move the jars to necessary
> > location and rename the jars during validate phase. After which i expect
> > the
> > compile to execute.
> >
> > But i see that dependency resolution happens first before any tasks can
> be
> > executed. Is it that i should write a separate ant script to do this
> before
> > running maven.
> > I am using maven 2.1.0.
> >
> > Is there a better way to accomplish this?
> >
> > Thanks,
> > Vijay
> >
>

Re: Running ANT task before pulling down dependencies

Posted by Anders Hammar <an...@hammar.net>.
Any reason why you're trying to build your own solution instead of going the
Maven way by setting up a corporate repository populated with these
artifacts? Not only would it be the right solution, my guess is that it
would be so much easier than going against Maven.

/Anders

On Wed, Dec 2, 2009 at 07:06, Vijay Venkataraman <
vijay.venkataraman@gmail.com> wrote:

> Hi,
> Currently i am trying to get maven project setup which creates a jar
> artifact. I have setup the project structure.
> Unfortunately i we don't have the libraries in central repository as per
> maven layout and jars don't have version numbers.
> They are jars like product1.jar, product2.jar. These jars are the project
> dependencies.
> I was thinking of running ant task which will move the jars to necessary
> location and rename the jars during validate phase. After which i expect
> the
> compile to execute.
>
> But i see that dependency resolution happens first before any tasks can be
> executed. Is it that i should write a separate ant script to do this before
> running maven.
> I am using maven 2.1.0.
>
> Is there a better way to accomplish this?
>
> Thanks,
> Vijay
>