Reputation: 14458
Currently, I found that it's very inefficient use of Maven in our team. So I have this question.
We have a large project consists of 300-500 modules which are organized by Maven 3, I have divided it into 10 sub-projects, so each sub-project have a root pom.xml
. Say they are project1, project2, .. projectN. I mainly work on project3
consists of 30 modules, they are then depended by project4
and project5
.
project3:
module3-1 SNAPSHOT
module3-2 SNAPSHOT
module3-3 SNAPSHOT
module3-4 SNAPSHOT
module3-5 SNAPSHOT
module3-6 RELEASE
...
module3-30 RELEASE
In project3, some not so often changes modules are released, and some (module3-1..3-5) are changed very frequently, so I use SNAPSHOT versions here.
We have run an Archiva server to manage all the artifacts, include both released and snapshots version.
Now the problem is, when I changed something in my project3
, generally I would like to deploy the whole sub-project:
[my-ubuntu] ~/project3/$ mvn clean; mvn deploy
...
EVERYTHING SUCCEED
[my-ubuntu] ~/project3/$
For what I expect is, all the snapshot versions should be automatically downloaded & updated in other people's machines.
In command line, it's worked as expected:
[john's ubuntu] ~/project4/$ mvn package
...
download http://archiva-server/snapshots/project3/...-SNAPSHOT... [SUCCEEDED]
...
EVERYTHING SUCCEED
[john's ubuntu] ~/project4/$
However, Gin hate command line, so he use M2eclipse, but M2eclipse won't automaticlly update the snapshots. I have tried:
TRY 1:
Disable dependency resolution
Enable dependency resolution
(This take maybe 30 minutes, and make eclipse hang, so I don't like. And it seems not work most of time, not download the latest snapshots sometimes)
TRY 2:
Update all dependnecies
Refresh projects
(This take about maybe 5 minutes, but not work some time, not download the latest snapshots sometimes)
TRY 3:
Delete all projects from eclipse workspace
Re-import all projects
(This take maybe 10 minutes, and most "clean" way, though not very fast but okay)
(But not download the latest snapshots sometimes)
TRY 4:
[gin's ubuntu] ~/project4/$ cd ~/.m2/repository/../project3
[gin's ubuntu] ~/.m2/repository/../project3 $ find -name 'resolve-*' -delete
Refresh eclipse projects
(This take about maybe 5 minutes? Well I haven't time it, though.)
(This is the best resolution in my experience, it downloads all snapshots everytime, so it's the final-resolution, well sounds like problem-killer.)
So, I my personal experience, to delete resolve-*
files in local repository seems the best resolution, but it's just not feel good.
Compared with command-line invoke mvn
, all IDE sucks.. Well maybe I didn't manage Maven in a correct way?
I'd like to know the best workflows to use Maven correctly in Eclipse/Idea stuff IDEs.
Upvotes: 0
Views: 207
Reputation: 97409
First You should think about the organization of your projects and their relationship to each other. May be you should about Multimodule builds to handle some of the situations in a better way.
Furthmore you have to change the configuration of the repositories to download the SNAPSHOT versions directly. Change the settings.xml in particular the update policy.
Upvotes: 1