You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by sethcall <se...@gmail.com> on 2012/03/07 02:32:05 UTC

Preferring local repository over remote for 'work sessions'

I'm trying to understand how I can accomplish a particular workflow.

First, some terms:

org:project-a:1.0-SNAPSHOT
org:project-b:1.0-SNAPSHOT
org.project-c:1.0-SNAPSHOT  DEPENDS_ON org.project-a:1.0-SNAPSHOT,
org.project-b:1.0-SNAPSHOT

Assume that we have a build server regularly building project-a and
project-b, and placing into an HTTP repository, like Artifactory.

Problem workflow:

User downloads project-b and project-c, but not project-a.  User fixes a bug
in project-b.  User does a 'mvn install' locally on both project-b and
project-c.    The user hasn't checked in anything yet to SCM.

For the time being, project-c should use project-b from the local repository
because it's the latest 1.0-SNAPSHOT, right?

Ok. Assume that now, the build server builds a new 1.0-SNAPSHOT of
project-b.  From the documentation I've read on maven, project-c will now
resolve against the latest version; which is in the remote repository.

This is problematic if you have actively changed project-b and were hoping
it to remain active while your working on it.  Your bug fix won't be in
effect because you are using the remote/build-server project-b, which
doesn't have your fix.

Also, I don't want to use mvn -o (offline), because if I haven't downloaded
project-a, and if there are changes, then I'd still like to get updates to
it as I'm working, per usual SNAPSHOT behavior.    Another way to put this:
I'm trying to solve this in a per-dependency way.

I have some ideas on how to solve this, none of which sound good to me, but
I first wanted to hear what anyone would suggest that I do, before I make
this post longer...

Thanks for any help,
Seth

--
View this message in context: http://maven.40175.n5.nabble.com/Preferring-local-repository-over-remote-for-work-sessions-tp5542872p5542872.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: Preferring local repository over remote for 'work sessions'

Posted by Seth Call <se...@gmail.com>.
It's not specific to Maven, but solving it is very much a developer workflow
problem, and the trick is to find what's the lowest-impact way that Maven
lets me solve this problem :)

--
View this message in context: http://maven.40175.n5.nabble.com/Preferring-local-repository-over-remote-for-work-sessions-tp5542872p5543052.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: Preferring local repository over remote for 'work sessions'

Posted by Wayne Fay <wa...@gmail.com>.
> For the time being, project-c should use project-b from the local repository
> because it's the latest 1.0-SNAPSHOT, right?

Sure.

> Ok. Assume that now, the build server builds a new 1.0-SNAPSHOT of
> project-b.  From the documentation I've read on maven, project-c will now
> resolve against the latest version; which is in the remote repository.

Yes. But Maven will only see that changed project-b artifact if you
tell it to look for it (via -U or --update-snapshots) or if the
repository update policy is "always" or the specified timeout (via
updatePolicy) has expired:
http://maven.apache.org/ref/3.0.4/maven-settings/settings.html#class_snapshots

> I have some ideas on how to solve this, none of which sound good to me, but
> I first wanted to hear what anyone would suggest that I do, before I make
> this post longer...

If you simply limit the number of developers making changes to the
same artifact simultaneously, this becomes a smaller issue and more
manageable. If you cannot do that, then break your artifact into
smaller pieces until you can.

This is a problem no matter what build tool you are using and not
specific to Maven.

Wayne

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


Re: Preferring local repository over remote for 'work sessions'

Posted by Seth Call <se...@gmail.com>.
The http://mojo.codehaus.org/versions-maven-plugin/ is very close to the
power tool I need, thanks for drawing my attention to it.

The only thing I'm struggling with after reading that is this... 

I consider the 'locked' dependencies a developer-only pattern (
http://mojo.codehaus.org/versions-maven-plugin/lock-snapshots-mojo.html
lock-snapshots ); meaning I'd like to prevent the developer from checking in
a 'locked' pom.  However, that can be resolved by server-side SCM hooks, I
suppose.

It's times like this I wish there were a way to override just a tiny piece
of the pom using a 'pom-override.xml' (or something along these lines). I'd
place such a file in my SCM ignore file (I don't want to add server-side
hooks if I can help it).

But like anything with regard to maven, I wouldn't want such an override
file unless the popular IDEs supported parsing them...

Anyway, thanks.  I'll work assuming this plugin is a part of the flow...



--
View this message in context: http://maven.40175.n5.nabble.com/Preferring-local-repository-over-remote-for-work-sessions-tp5542872p5543051.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