You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by Harilal Ayyathan S <ha...@gmail.com> on 2016/05/10 10:56:30 UTC

Maven clean install execution strategy

Hi Team,
     I have noticed an scenario (yet to confirm it's the way of Maven or
not) with one of my Maven project.
Scenario:
       My Maven war project has several custom jars and in common
developers adding these jars to web-inf lib folder. Along with
this,developers used to update pom file with the corresponding jar entry as
dependency. And we have configured one more entry in pom with execution -
"install-file" (and it's configured with "clean" phase") for the custom
jars. So the custom jars will be added to Maven repository at the time of
mvn clean. Up to this every thing is working as expected.
        In our deployment automation script we have only one entry to
update for Maven project and it's "mvn clean install". As usual we expected
the custom jar will be installed to repo and then only it check for the
dependency. Here the problem came. Before cleaning phase  Maven look for
the dependency in local repo and build is failured due to missing of our
custom jars. As per our script, clean phase should run first and then only
jars will be added to local repo.
   In brief if "mvn clean install" is called, maven first check for
dependency and if all dependencies are fine then only it go to clean phase.
So I want to know is this an expected behavior of maven?
If so how we can install the custom jars using pom before the dependency
check (not using install scripts)?
(ver: Apache Maven 3.3.9)
Thanks and Regards,
Harilal.A.S

Re: Fwd: Maven clean install execution strategy

Posted by Harilal Ayyathan S <ha...@gmail.com>.
Hi Chris,
Thank you for the support.
I know using script is the actual and best practice and we followed same.
Since our team is of more than 500 members working from different locations
and there may chance to add jars as per requirements we started looking on
alternative way. All these members need to run the script once they took
latest code. Some of the team members are in different timezone too. If the
pom approach is working, along with the code, developers can update their
local  repo too without any script. (Previously we have a project central
repository, but because of some firewall issues we have dropped same). So
we planned to use this maven pom feature to install custom jars.

Thanks and Regards,
Harilal.A.S.
On 11-May-2016 6:52 AM, "Chris Graham" <ch...@gmail.com> wrote:

> Do the install-file ONCE, outside of your Pom. Ideally deploy-file into
> one of your local repos.
>
> What you are doing is wrong, and unnecessary. If you have upgraded
> recently (mvn) then this is what has pointed out the bad practice you are
> doing.
>
> In short, work with the tool, not against it as you are, and you will be
> fine.
>
> -Chris
>
> Sent from my iPhone
>
> Begin forwarded message:
>
> *From:* Harilal Ayyathan S <ha...@gmail.com>
> *Date:* 10 May 2016 at 8:56:30 PM AEST
> *To:* issues@maven.apache.org
> *Subject:* *Maven clean install execution strategy*
> *Reply-To:* dev@maven.apache.org
>
> Hi Team,
>     I have noticed an scenario (yet to confirm it's the way of Maven or
> not) with one of my Maven project.
> Scenario:
>       My Maven war project has several custom jars and in common
> developers adding these jars to web-inf lib folder. Along with
> this,developers used to update pom file with the corresponding jar entry as
> dependency. And we have configured one more entry in pom with execution -
> "install-file" (and it's configured with "clean" phase") for the custom
> jars. So the custom jars will be added to Maven repository at the time of
> mvn clean. Up to this every thing is working as expected.
>        In our deployment automation script we have only one entry to
> update for Maven project and it's "mvn clean install". As usual we expected
> the custom jar will be installed to repo and then only it check for the
> dependency. Here the problem came. Before cleaning phase  Maven look for
> the dependency in local repo and build is failured due to missing of our
> custom jars. As per our script, clean phase should run first and then only
> jars will be added to local repo.
>   In brief if "mvn clean install" is called, maven first check for
> dependency and if all dependencies are fine then only it go to clean phase.
> So I want to know is this an expected behavior of maven?
> If so how we can install the custom jars using pom before the dependency
> check (not using install scripts)?
> (ver: Apache Maven 3.3.9)
> Thanks and Regards,
> Harilal.A.S
>
>