You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by mingleizhang <18...@163.com> on 2017/08/31 02:26:39 UTC

What kind of dependency will package to a jar file by means of maven ?

Hello, friends here
       
        Recently, I use mvn clean package or something like that to my project, then, I found the jar file is about more than 100MB size. But I dont want some dependency to exist in my finally jar file. there are three dependency file in pom like the following. The first one is a junit dependency. the second one is a google.protobuf-java-format. The last is a flink with provided. My question is, when I use mvn clean package, which will package to my final jar file ? I think google.protobuf-java-format will go to my jar file. Correct ? I am not sure whether junit package to my jar file. Does anyone improve my mind ? 


   <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
     </dependency>


     <dependency>
            <groupId>com.googlecode.protobuf-java-format</groupId>
            <artifactId>protobuf-java-format</artifactId>
            <version>1.2</version>
        </dependency>


       <dependency>
            <groupId>org.apache.flink</groupId>
            <artifactId>flink-scala_2.10</artifactId>
            <version>${flink.version}</version>
            <scope>provided</scope>
        </dependency>


Thanks
Minglei.

Re: When time do we need to delete .m2/repository

Posted by Richard Kirby <rb...@capdm.com>.
Rice,

You can delete it anytime you like. The cost is that the next time you run
maven it will take time to download all the dependencies. Still it is a
reasonable way of resetting your maven, and clearing out old dependencies
that you no longer use in your projects.

Regards

Richard

On 1 September 2017 at 04:31, mingleizhang <zm...@163.com> wrote:

> Hello friends here.
>
>
>      I would like ask a question ,it probably looks silly, but I still
> want to know. As the subject said, when time do we need to delete
> .m2/repository files ? Does anyone improve my mind ? Thank you very much!
>
>
> Thanks
> Rice.




-- 
Richard Kirby, Technical Director
CAPDM Limited - Online Program Enablers
Direct phone: 0131 477 8629
Email: rbk@capdm.com  Website: www.capdm.com
Registered in Scotland: SC168970       VAT: 682 846 983
Registered address: 22 Forth Street, Edinburgh, EH1 3LH, UK

Capture, author, publish, deliver and manage your learning materials

Re: When time do we need to delete .m2/repository

Posted by John Patrick <nh...@gmail.com>.
when every your running out of disk space

you can also use this plugin
http://www.mojohaus.org/build-helper-maven-plugin/remove-project-artifact-mojo.html
so when you do a clean or a install, it will also remove that project
from your local repo.

e.g. if your building a JEE project or other war project, then it will
mean you only have the currently build version in your local repo.
which is probably what you actually need. as your build server should
be publishing released versions and putting them into a central
server. so if you need a released version then you can simply download
it.


On 1 September 2017 at 04:31, mingleizhang <zm...@163.com> wrote:
> Hello friends here.
>
>
>      I would like ask a question ,it probably looks silly, but I still want to know. As the subject said, when time do we need to delete .m2/repository files ? Does anyone improve my mind ? Thank you very much!
>
>
> Thanks
> Rice.

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


Re: When time do we need to delete .m2/repository

Posted by Mark Derricutt <ma...@talios.com>.
On 15 Sep 2017, at 20:29, Baptiste Mathus wrote:

> So, yes, using dependency:purge-local-repository can help that use
> case/issue, but again IMO it's not worth it: just wipe out everything and
> redownload.

My release alias I use sets -Dmaven.repo.local=/tmp/maven-release-repository for every release, this way I ensure my dependencies/transitives/plugins or anything are all fresh, accessible, and not polluted by local builds.

/tmp gets blown away anytime I restart - sure it makes release builds a little bit slower, but knowing everything required to build is still available, is a slight comfort ( esp. from some bad experiences of a corrupt local nexus server and having try and source some older artefact builds ).



---
"The ease with which a change can be implemented has no relevance at all to whether it is the right change for the (Java) Platform for all time." &mdash; Mark Reinhold.

Mark Derricutt
http://www.theoryinpractice.net
http://www.chaliceofblood.net
http://plus.google.com/+MarkDerricutt
http://twitter.com/talios
http://facebook.com/mderricutt

Re: When time do we need to delete .m2/repository

Posted by Baptiste Mathus <ml...@batmat.net>.
Well, it's getting slightly off topic, but maybe not.
With Maven, I strongly recommend you *totally* wipe out the local Maven
cache (aka repository, misleadingly named) on a regular basis. Like once a
week or so.
You could have a local release version, that has actually been built only
locally. So it would stay here, possibly hiding the real one, forever until
you remove it.
So, yes, using dependency:purge-local-repository can help that use
case/issue, but again IMO it's not worth it: just wipe out everything and
redownload.

In CI, because the reproducibility and non-flakiness should be valued
over/before anything else, automate this to be done every day or so.
Ideally, every single builds.
Bottom line: engineering time is orders of magnitude more expensive than
disk space and bandwidth. You don't want your build to fail (or *not* fail)
when it should (not) and have to dig into this.

Having a private repo/cache per job helps mitigate this, but certainly does
not remove the need to wipe it out as often as possible.

And it's not just me, see
http://blog.sonatype.com/2009/01/maven-continuous-integration-best-practices/

-- Baptiste

2017-09-12 14:30 GMT+02:00 John Patrick <nh...@gmail.com>:

> I do similar to Eric for jenkins.
>
> But also for both developer builds and jenkins, I've got all projects
> setup to use the
> http://www.mojohaus.org/build-helper-maven-plugin/remove-
> project-artifact-mojo.html
> plugin. With both a default and clean phase execution. So when either
> jenkins or a developer does a clean, old artifacts are removed. This I
> find stops the need to intervention of having to manually clean up the
> local repo.
>
> I've also got a local artifactory instance running inside a vagrant
> vm, so i can safely delete my local repo if I've trouble and it can
> download what i needs to again. It also helps when working offline or
> over a slow internet connection as most things I've already download
> previously.
>
> John
>
>
>
>
> On 12 September 2017 at 12:56, Eric B <eb...@gmail.com> wrote:
> > I have my jenkins jobs designed to use private m2 repos per job.  I dont
> > find the need to delete them since the only transient changes are the
> > snapshots, which get reevaluated at every build anyhow.
> >
> > Thanks
> >
> > Eric
> >
> >
> > On Sep 11, 2017 2:43 PM, "Stephen Connolly" <
> stephen.alan.connolly@gmail.com>
> > wrote:
> >
> > On Fri 8 Sep 2017 at 11:22, Baptiste Mathus <ml...@batmat.net> wrote:
> >
> >> Le 7 sept. 2017 17:00, "Tushar Kapila" <tg...@gmail.com> a écrit :
> >>
> >> I had to delete a directory once as i had pressed Ctrl-C while it was
> >> downloading jars and a 0kb jar was created. This was in 2013, maybe it
> >> downloads to a temp file and then create the final file? It took
> sometime
> >> to debug. Builds were failing for no reason only on that test box, but
> >> working fine on my dev box, lots of fun.
> >>
> >> > If you don't, and
> >> > you have static (persistent) agents, very bad things will happen at
> some
> >> point.
> >>
> >> Can you explain this? What agents?
> >>
> >>
> >> Hehe, I was talking about Jenkins agents, sorry just realized I mixed my
> >> MLs. I thought I was reading Jenkinsci-users one :).
> >
> >
> > Bad Ba(p)tiste™
> >
> > ;-)
> >
> >
> >>
> >>
> >> On Thu, Sep 7, 2017 at 1:59 PM, Baptiste Mathus <ml...@batmat.net> wrote:
> >>
> >> > 2017-09-07 9:17 GMT+02:00 Guang Chao <gu...@gmail.com>:
> >> >
> >> > > On Fri, Sep 1, 2017 at 11:31 AM, mingleizhang <
> zml13856086071@163.com>
> >> > > wrote:
> >> > >
> >> > > > Hello friends here.
> >> > > >
> >> > > >
> >> > > >      I would like ask a question ,it probably looks silly, but I
> >> still
> >> > > > want to know. As the subject said, when time do we need to delete
> >> > > > .m2/repository files ? Does anyone improve my mind ? Thank you
> very
> >> > much!
> >> > > >
> >> > > >
> >> > > >
> >> > > There is no need to do this unless you are out of disk space. It
> will
> >> > cause
> >> > > no harm, but maven will redownload all dependencies again. So that
> > will
> >> > > slow you down a bit.
> >> > >
> >> >
> >> > I am actually going to say the contrary. You should, at I'd even say,
> > you
> >> > *must* wipe out Maven repositories on a regular basis. If you don't,
> and
> >> > you have static (persistent) agents, very bad things will happen at
> some
> >> > point.
> >> >
> >> > So, yeah, redownloading it is going to add some time to build, but
> this
> >> is
> >> > a matter of speed vs. reproducibility, so better target
> >> reproduciblity/non
> >> > flakiness then see how to optimize, not the contrary.
> >> >
> >> > And obviously, *NEVER, EVER share that .m2/repository between running
> >> > builds*.
> >> >
> >> >
> >> > >
> >> > >
> >> > > > Thanks
> >> > > > Rice.
> >> > >
> >> > >
> >> > >
> >> > >
> >> > > --
> >> > > Guang <http://javadevnotes.com/java-string-to-integer-examples/>
> >> > >
> >> >
> >>
> >>
> >>
> >> --
> >> Regards
> >> Tushar Kapila
> >>
> > --
> > Sent from my phone
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: When time do we need to delete .m2/repository

Posted by John Patrick <nh...@gmail.com>.
I do similar to Eric for jenkins.

But also for both developer builds and jenkins, I've got all projects
setup to use the
http://www.mojohaus.org/build-helper-maven-plugin/remove-project-artifact-mojo.html
plugin. With both a default and clean phase execution. So when either
jenkins or a developer does a clean, old artifacts are removed. This I
find stops the need to intervention of having to manually clean up the
local repo.

I've also got a local artifactory instance running inside a vagrant
vm, so i can safely delete my local repo if I've trouble and it can
download what i needs to again. It also helps when working offline or
over a slow internet connection as most things I've already download
previously.

John




On 12 September 2017 at 12:56, Eric B <eb...@gmail.com> wrote:
> I have my jenkins jobs designed to use private m2 repos per job.  I dont
> find the need to delete them since the only transient changes are the
> snapshots, which get reevaluated at every build anyhow.
>
> Thanks
>
> Eric
>
>
> On Sep 11, 2017 2:43 PM, "Stephen Connolly" <st...@gmail.com>
> wrote:
>
> On Fri 8 Sep 2017 at 11:22, Baptiste Mathus <ml...@batmat.net> wrote:
>
>> Le 7 sept. 2017 17:00, "Tushar Kapila" <tg...@gmail.com> a écrit :
>>
>> I had to delete a directory once as i had pressed Ctrl-C while it was
>> downloading jars and a 0kb jar was created. This was in 2013, maybe it
>> downloads to a temp file and then create the final file? It took sometime
>> to debug. Builds were failing for no reason only on that test box, but
>> working fine on my dev box, lots of fun.
>>
>> > If you don't, and
>> > you have static (persistent) agents, very bad things will happen at some
>> point.
>>
>> Can you explain this? What agents?
>>
>>
>> Hehe, I was talking about Jenkins agents, sorry just realized I mixed my
>> MLs. I thought I was reading Jenkinsci-users one :).
>
>
> Bad Ba(p)tiste™
>
> ;-)
>
>
>>
>>
>> On Thu, Sep 7, 2017 at 1:59 PM, Baptiste Mathus <ml...@batmat.net> wrote:
>>
>> > 2017-09-07 9:17 GMT+02:00 Guang Chao <gu...@gmail.com>:
>> >
>> > > On Fri, Sep 1, 2017 at 11:31 AM, mingleizhang <zm...@163.com>
>> > > wrote:
>> > >
>> > > > Hello friends here.
>> > > >
>> > > >
>> > > >      I would like ask a question ,it probably looks silly, but I
>> still
>> > > > want to know. As the subject said, when time do we need to delete
>> > > > .m2/repository files ? Does anyone improve my mind ? Thank you very
>> > much!
>> > > >
>> > > >
>> > > >
>> > > There is no need to do this unless you are out of disk space. It will
>> > cause
>> > > no harm, but maven will redownload all dependencies again. So that
> will
>> > > slow you down a bit.
>> > >
>> >
>> > I am actually going to say the contrary. You should, at I'd even say,
> you
>> > *must* wipe out Maven repositories on a regular basis. If you don't, and
>> > you have static (persistent) agents, very bad things will happen at some
>> > point.
>> >
>> > So, yeah, redownloading it is going to add some time to build, but this
>> is
>> > a matter of speed vs. reproducibility, so better target
>> reproduciblity/non
>> > flakiness then see how to optimize, not the contrary.
>> >
>> > And obviously, *NEVER, EVER share that .m2/repository between running
>> > builds*.
>> >
>> >
>> > >
>> > >
>> > > > Thanks
>> > > > Rice.
>> > >
>> > >
>> > >
>> > >
>> > > --
>> > > Guang <http://javadevnotes.com/java-string-to-integer-examples/>
>> > >
>> >
>>
>>
>>
>> --
>> Regards
>> Tushar Kapila
>>
> --
> Sent from my phone

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


Re: When time do we need to delete .m2/repository

Posted by Eric B <eb...@gmail.com>.
I have my jenkins jobs designed to use private m2 repos per job.  I dont
find the need to delete them since the only transient changes are the
snapshots, which get reevaluated at every build anyhow.

Thanks

Eric


On Sep 11, 2017 2:43 PM, "Stephen Connolly" <st...@gmail.com>
wrote:

On Fri 8 Sep 2017 at 11:22, Baptiste Mathus <ml...@batmat.net> wrote:

> Le 7 sept. 2017 17:00, "Tushar Kapila" <tg...@gmail.com> a écrit :
>
> I had to delete a directory once as i had pressed Ctrl-C while it was
> downloading jars and a 0kb jar was created. This was in 2013, maybe it
> downloads to a temp file and then create the final file? It took sometime
> to debug. Builds were failing for no reason only on that test box, but
> working fine on my dev box, lots of fun.
>
> > If you don't, and
> > you have static (persistent) agents, very bad things will happen at some
> point.
>
> Can you explain this? What agents?
>
>
> Hehe, I was talking about Jenkins agents, sorry just realized I mixed my
> MLs. I thought I was reading Jenkinsci-users one :).


Bad Ba(p)tiste™

;-)


>
>
> On Thu, Sep 7, 2017 at 1:59 PM, Baptiste Mathus <ml...@batmat.net> wrote:
>
> > 2017-09-07 9:17 GMT+02:00 Guang Chao <gu...@gmail.com>:
> >
> > > On Fri, Sep 1, 2017 at 11:31 AM, mingleizhang <zm...@163.com>
> > > wrote:
> > >
> > > > Hello friends here.
> > > >
> > > >
> > > >      I would like ask a question ,it probably looks silly, but I
> still
> > > > want to know. As the subject said, when time do we need to delete
> > > > .m2/repository files ? Does anyone improve my mind ? Thank you very
> > much!
> > > >
> > > >
> > > >
> > > There is no need to do this unless you are out of disk space. It will
> > cause
> > > no harm, but maven will redownload all dependencies again. So that
will
> > > slow you down a bit.
> > >
> >
> > I am actually going to say the contrary. You should, at I'd even say,
you
> > *must* wipe out Maven repositories on a regular basis. If you don't, and
> > you have static (persistent) agents, very bad things will happen at some
> > point.
> >
> > So, yeah, redownloading it is going to add some time to build, but this
> is
> > a matter of speed vs. reproducibility, so better target
> reproduciblity/non
> > flakiness then see how to optimize, not the contrary.
> >
> > And obviously, *NEVER, EVER share that .m2/repository between running
> > builds*.
> >
> >
> > >
> > >
> > > > Thanks
> > > > Rice.
> > >
> > >
> > >
> > >
> > > --
> > > Guang <http://javadevnotes.com/java-string-to-integer-examples/>
> > >
> >
>
>
>
> --
> Regards
> Tushar Kapila
>
--
Sent from my phone

Re: When time do we need to delete .m2/repository

Posted by Stephen Connolly <st...@gmail.com>.
On Fri 8 Sep 2017 at 11:22, Baptiste Mathus <ml...@batmat.net> wrote:

> Le 7 sept. 2017 17:00, "Tushar Kapila" <tg...@gmail.com> a écrit :
>
> I had to delete a directory once as i had pressed Ctrl-C while it was
> downloading jars and a 0kb jar was created. This was in 2013, maybe it
> downloads to a temp file and then create the final file? It took sometime
> to debug. Builds were failing for no reason only on that test box, but
> working fine on my dev box, lots of fun.
>
> > If you don't, and
> > you have static (persistent) agents, very bad things will happen at some
> point.
>
> Can you explain this? What agents?
>
>
> Hehe, I was talking about Jenkins agents, sorry just realized I mixed my
> MLs. I thought I was reading Jenkinsci-users one :).


Bad Ba(p)tiste™

;-)


>
>
> On Thu, Sep 7, 2017 at 1:59 PM, Baptiste Mathus <ml...@batmat.net> wrote:
>
> > 2017-09-07 9:17 GMT+02:00 Guang Chao <gu...@gmail.com>:
> >
> > > On Fri, Sep 1, 2017 at 11:31 AM, mingleizhang <zm...@163.com>
> > > wrote:
> > >
> > > > Hello friends here.
> > > >
> > > >
> > > >      I would like ask a question ,it probably looks silly, but I
> still
> > > > want to know. As the subject said, when time do we need to delete
> > > > .m2/repository files ? Does anyone improve my mind ? Thank you very
> > much!
> > > >
> > > >
> > > >
> > > There is no need to do this unless you are out of disk space. It will
> > cause
> > > no harm, but maven will redownload all dependencies again. So that will
> > > slow you down a bit.
> > >
> >
> > I am actually going to say the contrary. You should, at I'd even say, you
> > *must* wipe out Maven repositories on a regular basis. If you don't, and
> > you have static (persistent) agents, very bad things will happen at some
> > point.
> >
> > So, yeah, redownloading it is going to add some time to build, but this
> is
> > a matter of speed vs. reproducibility, so better target
> reproduciblity/non
> > flakiness then see how to optimize, not the contrary.
> >
> > And obviously, *NEVER, EVER share that .m2/repository between running
> > builds*.
> >
> >
> > >
> > >
> > > > Thanks
> > > > Rice.
> > >
> > >
> > >
> > >
> > > --
> > > Guang <http://javadevnotes.com/java-string-to-integer-examples/>
> > >
> >
>
>
>
> --
> Regards
> Tushar Kapila
>
-- 
Sent from my phone

Re: When time do we need to delete .m2/repository

Posted by Baptiste Mathus <ml...@batmat.net>.
Le 7 sept. 2017 17:00, "Tushar Kapila" <tg...@gmail.com> a écrit :

I had to delete a directory once as i had pressed Ctrl-C while it was
downloading jars and a 0kb jar was created. This was in 2013, maybe it
downloads to a temp file and then create the final file? It took sometime
to debug. Builds were failing for no reason only on that test box, but
working fine on my dev box, lots of fun.

> If you don't, and
> you have static (persistent) agents, very bad things will happen at some
point.

Can you explain this? What agents?


Hehe, I was talking about Jenkins agents, sorry just realized I mixed my
MLs. I thought I was reading Jenkinsci-users one :).


On Thu, Sep 7, 2017 at 1:59 PM, Baptiste Mathus <ml...@batmat.net> wrote:

> 2017-09-07 9:17 GMT+02:00 Guang Chao <gu...@gmail.com>:
>
> > On Fri, Sep 1, 2017 at 11:31 AM, mingleizhang <zm...@163.com>
> > wrote:
> >
> > > Hello friends here.
> > >
> > >
> > >      I would like ask a question ,it probably looks silly, but I still
> > > want to know. As the subject said, when time do we need to delete
> > > .m2/repository files ? Does anyone improve my mind ? Thank you very
> much!
> > >
> > >
> > >
> > There is no need to do this unless you are out of disk space. It will
> cause
> > no harm, but maven will redownload all dependencies again. So that will
> > slow you down a bit.
> >
>
> I am actually going to say the contrary. You should, at I'd even say, you
> *must* wipe out Maven repositories on a regular basis. If you don't, and
> you have static (persistent) agents, very bad things will happen at some
> point.
>
> So, yeah, redownloading it is going to add some time to build, but this is
> a matter of speed vs. reproducibility, so better target reproduciblity/non
> flakiness then see how to optimize, not the contrary.
>
> And obviously, *NEVER, EVER share that .m2/repository between running
> builds*.
>
>
> >
> >
> > > Thanks
> > > Rice.
> >
> >
> >
> >
> > --
> > Guang <http://javadevnotes.com/java-string-to-integer-examples/>
> >
>



--
Regards
Tushar Kapila

Re: When time do we need to delete .m2/repository

Posted by Tushar Kapila <tg...@gmail.com>.
I had to delete a directory once as i had pressed Ctrl-C while it was
downloading jars and a 0kb jar was created. This was in 2013, maybe it
downloads to a temp file and then create the final file? It took sometime
to debug. Builds were failing for no reason only on that test box, but
working fine on my dev box, lots of fun.

> If you don't, and
> you have static (persistent) agents, very bad things will happen at some
point.

Can you explain this? What agents?

On Thu, Sep 7, 2017 at 1:59 PM, Baptiste Mathus <ml...@batmat.net> wrote:

> 2017-09-07 9:17 GMT+02:00 Guang Chao <gu...@gmail.com>:
>
> > On Fri, Sep 1, 2017 at 11:31 AM, mingleizhang <zm...@163.com>
> > wrote:
> >
> > > Hello friends here.
> > >
> > >
> > >      I would like ask a question ,it probably looks silly, but I still
> > > want to know. As the subject said, when time do we need to delete
> > > .m2/repository files ? Does anyone improve my mind ? Thank you very
> much!
> > >
> > >
> > >
> > There is no need to do this unless you are out of disk space. It will
> cause
> > no harm, but maven will redownload all dependencies again. So that will
> > slow you down a bit.
> >
>
> I am actually going to say the contrary. You should, at I'd even say, you
> *must* wipe out Maven repositories on a regular basis. If you don't, and
> you have static (persistent) agents, very bad things will happen at some
> point.
>
> So, yeah, redownloading it is going to add some time to build, but this is
> a matter of speed vs. reproducibility, so better target reproduciblity/non
> flakiness then see how to optimize, not the contrary.
>
> And obviously, *NEVER, EVER share that .m2/repository between running
> builds*.
>
>
> >
> >
> > > Thanks
> > > Rice.
> >
> >
> >
> >
> > --
> > Guang <http://javadevnotes.com/java-string-to-integer-examples/>
> >
>



-- 
Regards
Tushar Kapila

Re: When time do we need to delete .m2/repository

Posted by Guang Chao <gu...@gmail.com>.
On Thu, Sep 7, 2017 at 4:29 PM, Baptiste Mathus <ml...@batmat.net> wrote:

> 2017-09-07 9:17 GMT+02:00 Guang Chao <gu...@gmail.com>:
>
> > On Fri, Sep 1, 2017 at 11:31 AM, mingleizhang <zm...@163.com>
> > wrote:
> >
> > > Hello friends here.
> > >
> > >
> > >      I would like ask a question ,it probably looks silly, but I still
> > > want to know. As the subject said, when time do we need to delete
> > > .m2/repository files ? Does anyone improve my mind ? Thank you very
> much!
> > >
> > >
> > >
> > There is no need to do this unless you are out of disk space. It will
> cause
> > no harm, but maven will redownload all dependencies again. So that will
> > slow you down a bit.
> >
>
> I am actually going to say the contrary. You should, at I'd even say, you
> *must* wipe out Maven repositories on a regular basis. If you don't, and
> you have static (persistent) agents, very bad things will happen at some
> point.
>
> So, yeah, redownloading it is going to add some time to build, but this is
> a matter of speed vs. reproducibility, so better target reproduciblity/non
> flakiness then see how to optimize, not the contrary.
>

I stand corrected.  Also with very good speeds now where 100mbps is common,
should be ok.


>
> And obviously, *NEVER, EVER share that .m2/repository between running
> builds*.
>
>
> >
> >
> > > Thanks
> > > Rice.
> >
> >
> >
> >
> > --
> > Guang <http://javadevnotes.com/java-string-to-integer-examples/>
> >
>



-- 
Guang <http://javadevnotes.com/java-integer-to-string-examples/>

Re: When time do we need to delete .m2/repository

Posted by Baptiste Mathus <ml...@batmat.net>.
2017-09-07 9:17 GMT+02:00 Guang Chao <gu...@gmail.com>:

> On Fri, Sep 1, 2017 at 11:31 AM, mingleizhang <zm...@163.com>
> wrote:
>
> > Hello friends here.
> >
> >
> >      I would like ask a question ,it probably looks silly, but I still
> > want to know. As the subject said, when time do we need to delete
> > .m2/repository files ? Does anyone improve my mind ? Thank you very much!
> >
> >
> >
> There is no need to do this unless you are out of disk space. It will cause
> no harm, but maven will redownload all dependencies again. So that will
> slow you down a bit.
>

I am actually going to say the contrary. You should, at I'd even say, you
*must* wipe out Maven repositories on a regular basis. If you don't, and
you have static (persistent) agents, very bad things will happen at some
point.

So, yeah, redownloading it is going to add some time to build, but this is
a matter of speed vs. reproducibility, so better target reproduciblity/non
flakiness then see how to optimize, not the contrary.

And obviously, *NEVER, EVER share that .m2/repository between running
builds*.


>
>
> > Thanks
> > Rice.
>
>
>
>
> --
> Guang <http://javadevnotes.com/java-string-to-integer-examples/>
>

Re: When time do we need to delete .m2/repository

Posted by Guang Chao <gu...@gmail.com>.
On Fri, Sep 1, 2017 at 11:31 AM, mingleizhang <zm...@163.com>
wrote:

> Hello friends here.
>
>
>      I would like ask a question ,it probably looks silly, but I still
> want to know. As the subject said, when time do we need to delete
> .m2/repository files ? Does anyone improve my mind ? Thank you very much!
>
>
>
There is no need to do this unless you are out of disk space. It will cause
no harm, but maven will redownload all dependencies again. So that will
slow you down a bit.


> Thanks
> Rice.




-- 
Guang <http://javadevnotes.com/java-string-to-integer-examples/>

When time do we need to delete .m2/repository

Posted by mingleizhang <zm...@163.com>.
Hello friends here.


     I would like ask a question ,it probably looks silly, but I still want to know. As the subject said, when time do we need to delete .m2/repository files ? Does anyone improve my mind ? Thank you very much!


Thanks
Rice.

Re:Re: What kind of dependency will package to a jar file by means of maven ?

Posted by mingleizhang <zm...@163.com>.
Thanks Gruss for your answer. It makes sense better to me now. maven-jar-plugin. hmmm. I never used it before seems. But I used assembly to package the dependencies.


Cheers
Minglei








At 2017-08-31 10:35:31, "Bernd Eckenfels" <ec...@zusammenkunft.net> wrote:
>Correct, only protobuf which is scope compile will get packaged.
>
>Scope provided and scope test are normally excluded scopes.
>
>However, it depends on your build plugins and how they are configured. The normal maven-jar-plugin will only include resources, dependencies can be included with shade, bundle or assembly plugins.
>
>Gruss
>Bernd
>--
>http://bernd.eckenfels.net
>________________________________
>From: mingleizhang <18...@163.com>
>Sent: Thursday, August 31, 2017 4:26:39 AM
>To: users@maven.apache.org
>Subject: What kind of dependency will package to a jar file by means of maven ?
>
>Hello, friends here
>
>        Recently, I use mvn clean package or something like that to my project, then, I found the jar file is about more than 100MB size. But I dont want some dependency to exist in my finally jar file. there are three dependency file in pom like the following. The first one is a junit dependency. the second one is a google.protobuf-java-format. The last is a flink with provided. My question is, when I use mvn clean package, which will package to my final jar file ? I think google.protobuf-java-format will go to my jar file. Correct ? I am not sure whether junit package to my jar file. Does anyone improve my mind ?
>
>
>   <dependency>
>            <groupId>junit</groupId>
>            <artifactId>junit</artifactId>
>            <version>${junit.version}</version>
>            <scope>test</scope>
>     </dependency>
>
>
>     <dependency>
>            <groupId>com.googlecode.protobuf-java-format</groupId>
>            <artifactId>protobuf-java-format</artifactId>
>            <version>1.2</version>
>        </dependency>
>
>
>       <dependency>
>            <groupId>org.apache.flink</groupId>
>            <artifactId>flink-scala_2.10</artifactId>
>            <version>${flink.version}</version>
>            <scope>provided</scope>
>        </dependency>
>
>
>Thanks
>Minglei.

Re: What kind of dependency will package to a jar file by means of maven ?

Posted by Bernd Eckenfels <ec...@zusammenkunft.net>.
Correct, only protobuf which is scope compile will get packaged.

Scope provided and scope test are normally excluded scopes.

However, it depends on your build plugins and how they are configured. The normal maven-jar-plugin will only include resources, dependencies can be included with shade, bundle or assembly plugins.

Gruss
Bernd
--
http://bernd.eckenfels.net
________________________________
From: mingleizhang <18...@163.com>
Sent: Thursday, August 31, 2017 4:26:39 AM
To: users@maven.apache.org
Subject: What kind of dependency will package to a jar file by means of maven ?

Hello, friends here

        Recently, I use mvn clean package or something like that to my project, then, I found the jar file is about more than 100MB size. But I dont want some dependency to exist in my finally jar file. there are three dependency file in pom like the following. The first one is a junit dependency. the second one is a google.protobuf-java-format. The last is a flink with provided. My question is, when I use mvn clean package, which will package to my final jar file ? I think google.protobuf-java-format will go to my jar file. Correct ? I am not sure whether junit package to my jar file. Does anyone improve my mind ?


   <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
     </dependency>


     <dependency>
            <groupId>com.googlecode.protobuf-java-format</groupId>
            <artifactId>protobuf-java-format</artifactId>
            <version>1.2</version>
        </dependency>


       <dependency>
            <groupId>org.apache.flink</groupId>
            <artifactId>flink-scala_2.10</artifactId>
            <version>${flink.version}</version>
            <scope>provided</scope>
        </dependency>


Thanks
Minglei.