Getting up and running with Maven

Hi all!

I've tried to import pom-files before but somehow I always fail. I revert to using mvn idea:idea which I know isn't supported and every now and then I get into huge problems having to re-do all module-files, running mvn clean like 100 times and finally being able to start working again.

(I'll start here and probably/hopefully end up with more follow up questions as I progress)

So, our set up is quite common although perhaps not by the book. We have a parent pom that is the parent pom for all other poms. We do this to get smaller poms and to be able to manage global dependencies easy. However unusal, it works perfect running maven standalone.

A first easy step would be to add just one single of our modules. This won't be enough but at least get me starting.

Eventually I'll need to add somewhere between 5 and 10 different modules so my choice is to create an empty new project and then add the modules as I need them

And here is the first real question. What is "Maven Home Directory"? I'm running ubuntu and finding the "Maven User Settings File" and "Local Repository" is no problem.

Sorry for being fuzzy

6 comments
Comment actions Permalink

I managed to find out the answer to my first question with some help from my collegues. Maven Home Directory is, on my system, /usr/share/maven2. With that set I can now run the lifecycles from within idea. Big step forward.

My immediate second question is: How can I access profiles? command line I would run "mvn install -Pdeploy" or "mvn install -Pcodegen"

I tried to add a second module through another pom file and I just wont work

  1. I add two or more modules from within "project structure" and it looks alright. I have to change each of them from Ruby SDK to Java SDK but that's minor
  2. I close the dialog to find that only one of the module remains, the others are gone. I re-open "project structure" to find that there is just that one moduleI.
  3. I once again add a secondary module. This time it says "These modules have been removed from the maven structure...." and my already added module is listed


It just seems to me that either our pom-structure isn't supported or the maven support somewhat flaky....

Thanks.

0
Comment actions Permalink

your reply is in this forum already, try a search

0
Comment actions Permalink

It sounds like you think I haven't tried that, I have.

If you know there is an answer I'm sure you've just seen it. Why not just post a link to it and be helpful instead of, well.. not helpful.

0
Comment actions Permalink

I'm now trying a multi-project pom and it seems to work alright. I'm still building outside IDEA so the about 1 millon errors I get on project open doesn't bother me, as long as I find all the sources and can work with them I'm happy. The think I noticed that is less then optimal is:

  1. The svn-root is set to the directory of the super pom, not each individual pom. This one would be hard for IDEA to get so nothing much to do.
  2. Some source folders are missed and not marked as source but they can be fixed manually... I'll have to do this EVERY time I re-import which is every now and then but I can live with it.
  3. I get tons of build errors just by opening the projects. It will work but I wouldn't be able to build from within IDEA.
  4. In "Maven Projects" tab I only see the super poms life cycles, not the other ones. I normally just build one of them so if I where to build from IDEA this is what I would have wanted.


So, I'm happy but not satisfied. I'd really like to just open up all my pom-files and "have it work".

Thanks anyway.

0
Comment actions Permalink

not sure it will help you, but my "workspace pom" is not a parent pom of it's modules.

From a filesystem perspective, they're all children of the same parent

ex :

AA_workspace_subject1

pom.xml : this is the packaging=pom

module1 : this is a submodule

module2 : this is another submodule


And my AA_workspace_subject1's pom includes module1 and module2 as modules.

I can have multiple workspaces that include different projects depending on the subject I'm working on.
This works mostly fine for me, but won't help you if you need to specify profiles, as I believe it's not possible anymore to specify a profile at project import

0

Please sign in to leave a comment.