maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rob Withers" <reefed...@gmail.com>
Subject RE: noob confusion about dependencies and repositories
Date Sat, 06 Oct 2012 21:21:58 GMT


> From: Steinar Bang [mailto:sb@dod.no]
> >>>>> "Rob Withers" <reefedjib@gmail.com>:
> 
> >> What's the directory layout of your projects?  Where do you issue the
> >> command?  What are the error messages you're getting.
> 
> > workspace/
> >     murmur/
> >         pom.xml
> >     murmur-events/
> >         pom.xml
> 
> > I issue the command in the murmur-events dir and I have no parent
> > pom.xml and the error is:
> 
> > [ERROR] Failed to execute goal
> > org.apache.maven.plugins:maven-pmd-plugin:2.7.1:check (default) on
> > project murmur-events: You have 17 PMD violations. For more de tails
> > see:C:\rob\comp\workspace\murmur-events\target\pmd.xml -> [Help 1]
> 
> Right... one fix would be to fix those 17 PMD violations...;-)
> 
> Alternatively you can remove maven-pmd-plugin from the <plugins> section
> of the murmur-events/pom.xml.  Or you can use that same entry to
> configure the maven-pmd-plugin to be less strict (not sure if that's
> possible...?).

Exactly, I reduced the strictness.  The violations were not preventing compilation.  I want
to be able to install if it runs, then browse the violations and fix those that make sense.
 I have one method that increments a parameter and I don't want to fix that for clarity, for
example.


> >> >   5.. If the jar is named ‘murmur-events-1.0.1-SNAPSHOT.jar’, will
> >> > the above dependency of the following find it?
> >>
> >> Um... not sure I understood that...?
> 
> > This dependency section in the murmur pom:
> 
> > <dependency>
> >   <groupId>org.reefedjib</groupId>
> >   <artifactId>murmur-events</artifactId>
> >   <version>1.0.1-SNAPSHOT</version>
> > </dependency>
> 
> If that is the groupId+artifactId+version your actual murmur-events pom.xml
> has, and if murmur-events have been built and installed in your local
> repository, then yes, that shoud be enough.

Yep, it all works now.

 
> >> >   6.. What about setting up an internal repository?  Would that be
> >> > a better solution?
> >>
> >> What do you mean by an internal repository?  A repository for
> >> internal to your project?  Or a repository local to your site?
> 
> > Instead of a local repository, have a public repository at
> > http://callistosheart.org/maven or something.
> 
> If that is an option for you, then I'm sure it will be a good thing.
> I have only ever been allowed to set up an intranet repository...:-)
> 
> You can add that repository in your top pom.

So, how does this work?  What does the site file structure look like?


 
> >> >   7.. If I have the dependency in maven, will eclipse pick it up?
> >>
> >> Not eclipse by itself.  But you can either use the eclipse m2e plugin
> >> that will make maven projects appear as eclipse projects, or you can
> >> use the maven- eclipse-plugin to let maven generate the eclipse
> >> project settings.  You can also use maven as an external build tool in
> eclipse.
> 
> > Does Eclipse Juno include these plugins?
> 
> m2e?  By default?  No idea.
> 
> > It does have some level of support, but I am finding I need to go to
> > the command line to generate new projects.
> 
> That isn't m2e or eclipse.  That's the maven-eclipse-plugin.  If you do "mvn
> eclipse:eclipse" on the workspace level this maven plugin will generate the
> eclipse project files/directories in murmur-events and murmur.
> 
> The dependency from murmur to murmur-events will be a project
> dependency.
> 
> Note that you also need to "mvn eclipse:configure-workspace" on the
> workspace level before starting eclipse.  This will set the M2_REPO eclipse
> variable, pointing to your local repository.

Very cool.

> 
> > Thinking about this, I think I will establish a sample project with
> > everything and just copy it over to new projects I want to create and
> > update the artifactId in the pom.  This way I can have all my default
> > dependencies setup.
> 
> Hm... OK.  Maybe my test project can help you a little bit.  You can just start
> out with the project and verify that it builds, then add stuff and test builds
> and if it breaks figure out what makes it break....
> 
> Attached is the output from me doing "mvn install" on the test project.

I included several dependencies in the top and then overrode some of the analysis dependencies
in the one sub to be even less strict than the top.  Works like grace.

Thanks for your help,
Rob


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


Mime
View raw message