You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Rob Withers <re...@gmail.com> on 2012/10/06 03:34:58 UTC
noob confusion about dependencies and repositories
Hey y’all,
I am trying to link one project’s jar to another project. I am totally
confused and hope someone can take some time to explain. I have been
reading the following pages on the site:
http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html
http://maven.apache.org/guides/getting-started/index.html#How_do_I_create_a_JAR_and_install_it_in_my_local_repository
http://maven.apache.org/guides/introduction/introduction-to-repositories.html
I have the following tools:
a.. eclipse
b.. maven
c.. git
d.. jenkins
e.. findbugs
f.. pmd
my two projects are murmur-events and the other is murmur. Murmur has a
dependency to murmur-events.
My murmur-events pom has pmd and findbugs and failures in the mojo s
preventing installation of the jar.
Here is the dependency in the murmur pom:
<dependency>
<groupId>murmur-events</groupId>
<artifactId>murmur-events</artifactId>
<scope>runtime</scope>
<version>1.0.1-SNAPSHOT</version>
</dependency>
Here are my questions, I suppose:
1.. How can I install murmur-events, even though pmd/findbugs is issuing
warnings? The mvn install is failing.
2.. Where is the local repository where these get installed?
3.. Do I need to have a parent pom with two modules, one for each project?
Does this impact where my local repository is?
4.. Should I specify the murmur-events-1.0.1-SNAPSHOT.jar, as a dependency
in the murmur project, by system file path?
5.. If the jar is named ‘murmur-events-1.0.1-SNAPSHOT.jar’, will the above
dependency of the following find it?
6.. What about setting up an internal repository? Would that be a better
solution?
7.. If I have the dependency in maven, will eclipse pick it up?
Many thanks,
Rob
Re: noob confusion about dependencies and repositories
Posted by Steinar Bang <sb...@dod.no>.
>>>>> "Rob Withers" <re...@gmail.com>:
> Ok, I got around the issue with number 3 by removing the modules and
> building the top pom, then adding the modules.
Ok. What you did with that, was to add the top POM to your local
repository, and then the modules will find it there, rather than in
their parent directory.
Shouldn't be necessary... could it be the groupId mismatch...?
> I am now getting an error with murmur-events that is preventing
> installation and preventing murmur from building. Here is the error
> with PMD:
[...]
> Why are PMD warnings failing the murmur-events install?
Without knowing the first thing about maven-pmd-plugin, my guess is that
it is because the <reporting> section of the murmur-events/pom.xml file
references the maven-pmd-plugin.
And: the source files contain 17 PMD violations.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
RE: noob confusion about dependencies and repositories
Posted by Rob Withers <re...@gmail.com>.
Ok, I got around the issue with number 3 by removing the modules and building the top pom, then adding the modules. I am now getting an error with murmur-events that is preventing installation and preventing murmur from building. Here is the error with PMD:
[INFO] Reactor Summary:
[INFO]
[INFO] top ............................................... SUCCESS [2.171s]
[INFO] murmur-events ..................................... FAILURE [6.766s]
[INFO] Murmur ............................................ SKIPPED
[INFO] Genesis ........................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.341s
[INFO] Finished at: Sat Oct 06 06:26:03 EDT 2012
[INFO] Final Memory: 14M/34M
[INFO] ------------------------------------------------------------------------
[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]
Why are PMD warnings failing the murmur-events install?
Thanks,
Rob
> -----Original Message-----
> From: Rob Withers [mailto:reefedjib@gmail.com]
> Sent: Saturday, October 06, 2012 6:12 AM
> To: 'Maven Users List'
> Subject: RE: noob confusion about dependencies and repositories
>
> Thanks for your response, Steinar...
>
> > From: Steinar Bang [mailto:sb@dod.no]
> > >>>>> "Rob Withers" <re...@gmail.com>:
> >
> > > Here are my questions, I suppose:
> > > 1.. How can I install murmur-events, even though pmd/findbugs is
> > > issuing warnings? The mvn install is failing.
> >
> > 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]
>
>
>
> > > 3.. Do I need to have a parent pom with two modules, one for each
> > > project?
> >
> > That would be "the maven way", yes, structured so:
> >
> > murmur-top/
> > pom.xml
> > murmur-events/
> > pom.xml
> > murmur/
> > pom.xml
>
> Ok, I tried this and got an error in both the parent dir, when issuing the mvn
> command:
>
> C:\rob\comp\workspace>mvn
> [INFO] Scanning for projects...
> [ERROR] The build could not read 3 projects -> [Help 1] [ERROR]
> [ERROR] The project org.murmur:murmur-events:1.0.1-SNAPSHOT
> (C:\rob\comp\workspace\murmur-events\pom.xml) has 1 error
> [ERROR] Non-resolvable parent POM: Could not find artifact
> org.murmur:murmur-top:pom:1.0-SNAPSHOT and 'parent.relativePath'
> points at wrong local POM @ line
> 5, column 11 -> [Help 2]
> [ERROR]
> [ERROR] The project org.murmur:murmur:0.0.1-SNAPSHOT
> (C:\rob\comp\workspace\murmur\pom.xml) has 1 error
> [ERROR] Non-resolvable parent POM: Could not find artifact
> org.murmur:murmur-top:pom:1.0-SNAPSHOT and 'parent.relativePath'
> points at wrong local POM @ line
> 4, column 11 -> [Help 2]
>
> and an error in the subdir, when issuing the mvn command:
>
> C:\rob\comp\workspace\murmur-events>mvn
> [INFO] Scanning for projects...
> [ERROR] The build could not read 1 project -> [Help 1] [ERROR]
> [ERROR] The project org.murmur:murmur-events:1.0.1-SNAPSHOT
> (C:\rob\comp\workspace\murmur-events\pom.xml) has 1 error
> [ERROR] Non-resolvable parent POM: Could not find artifact
> org.murmur:murmur-top:pom:1.0-SNAPSHOT and 'parent.relativePath'
> points at wrong local POM @ line
> 5, column 11 -> [Help 2]
>
> These are really the same error.
>
>
>
> > > 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>
>
>
>
> > > 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.
>
>
>
> > > 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? It does have some level of support,
> but I am finding I need to go to the command line to generate new projects.
> 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.
>
>
> Thanks,
> Rob
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
RE: noob confusion about dependencies and repositories
Posted by Rob Withers <re...@gmail.com>.
Cool, I'll check it out after getting all my projects squared away...
Rob
> -----Original Message-----
> From: Wayne Fay [mailto:waynefay@gmail.com]
> Sent: Saturday, October 06, 2012 5:27 PM
> To: Maven Users List
> Subject: Re: noob confusion about dependencies and repositories
>
> >> > 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?
>
> Most people here run an MRM like Nexus, Artifactory, or Archiva. You can
> find lots of information about these systems at their respective sites.
>
> Wayne
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: noob confusion about dependencies and repositories
Posted by Steinar Bang <sb...@dod.no>.
>>>>> Steinar Bang <sb...@dod.no>:
> On the recommended book list mentioned earlier, I will in particular
> mention "Maven by example"
> http://www.sonatype.com/Support/Books/Maven-By-Example
The download page lists PDF and HTML versions. I was able to build
myself an ePub version for my Sony PRS-T1 ebook reader, with:
git clone https://github.com/sonatype/maven-example-en.git
cd maven-example-en
git checkout production
mvn install
The "mvn install" command failed for me, while creating the PDF file (a
403 when trying to load the Docbook DTD, with HTTP, I think). But ePub
succeeded, and the result was in
maven-example-en/mvnex-epub/target/epub/public-book.epub
I ran the ePub file through an epub->epub conversion in calibre to get a
more pleasing result in the Sony: I first added some missing metadata
(authors, and some tags), then did the conversion, picking the cover
from the existing epub files (otherwise the cover showed up as a blank
in the Sony reader), and told it not to split on page breaks.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: noob confusion about dependencies and repositories
Posted by Steinar Bang <sb...@dod.no>.
>>>>> "Rob Withers" <re...@gmail.com>:
> I am guilty for being lazy. I really hate all this build config
> stuff...
[snip!]
FWIW, in my experience embracing maven patterns allows you to reduce
build config to a minimum.
On the recommended book list mentioned earlier, I will in particular
mention "Maven by example"
http://www.sonatype.com/Support/Books/Maven-By-Example
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
RE: noob confusion about dependencies and repositories
Posted by Rob Withers <re...@gmail.com>.
> -----Original Message-----
> From: Barrie Treloar [mailto:baerrach@gmail.com]
>
> On Sun, Oct 7, 2012 at 9:34 AM, Rob Withers <re...@gmail.com> wrote:
> > I am guilty for being lazy. I really hate all this build config stuff
> > and with maven, git and Jenkins, plus FindBugs and PMD in all three
> > environments, it gets to me. I am totally up and running, minus some
> > issues as I split my project apart that I am working on. If I do go
> > for the public maven repos, I will be sure to read the books. You
> > have given me a crash course on it and I can us it effectively now.
> >
> > Now, back to coding, which is what I really like to do (minus a trip
> > back into JBoss land).
>
> You sound like you can get the stuff done, so I beg you to spend a small
> amount of time reading those docs.
>
> Instead of this stuff bugging you, you will understand how to quickly and
> easily get it fixed.
> Otherwise next time you run into these problems you will have that mental
> barrier that says this stuff is hard and annoying.
> It is only that way because you need to know the basics.
>
> You wont regret it.
Thank you. I can do it, for sure. I tend to read the docs and ask
questions at the same time, until I get my problem solved.
The issue is that these problems are peripheral to the problems I want to
solve, which is a secure promise-based distributed object messaging system.
Much more interesting and difficult in its own right. This stuff, while
very powerful when done right, and necessary, is like keeping my apartment
clean or cooking dinner! It is a chore. ;-)
That said, I do like maven a lot.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: noob confusion about dependencies and repositories
Posted by Barrie Treloar <ba...@gmail.com>.
On Sun, Oct 7, 2012 at 9:34 AM, Rob Withers <re...@gmail.com> wrote:
> I am guilty for being lazy. I really hate all this build config stuff and
> with maven, git and Jenkins, plus FindBugs and PMD in all three
> environments, it gets to me. I am totally up and running, minus some issues
> as I split my project apart that I am working on. If I do go for the public
> maven repos, I will be sure to read the books. You have given me a crash
> course on it and I can us it effectively now.
>
> Now, back to coding, which is what I really like to do (minus a trip back
> into JBoss land).
You sound like you can get the stuff done, so I beg you to spend a
small amount of time reading those docs.
Instead of this stuff bugging you, you will understand how to quickly
and easily get it fixed.
Otherwise next time you run into these problems you will have that
mental barrier that says this stuff is hard and annoying.
It is only that way because you need to know the basics.
You wont regret it.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
RE: noob confusion about dependencies and repositories
Posted by Rob Withers <re...@gmail.com>.
I am guilty for being lazy. I really hate all this build config stuff and
with maven, git and Jenkins, plus FindBugs and PMD in all three
environments, it gets to me. I am totally up and running, minus some issues
as I split my project apart that I am working on. If I do go for the public
maven repos, I will be sure to read the books. You have given me a crash
course on it and I can us it effectively now.
Now, back to coding, which is what I really like to do (minus a trip back
into JBoss land).
Cheers,
Rob
> -----Original Message-----
> From: Barrie Treloar [mailto:baerrach@gmail.com]
> Sent: Saturday, October 06, 2012 7:00 PM
> To: Maven Users List
> Subject: Re: noob confusion about dependencies and repositories
>
> On Sun, Oct 7, 2012 at 7:57 AM, Wayne Fay <wa...@gmail.com> wrote:
> >>> > 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?
> >
> > Most people here run an MRM like Nexus, Artifactory, or Archiva. You
> > can find lots of information about these systems at their respective
> > sites.
>
> Do not add a repository section to you pom.
> That will cause everyone else who uses your artifacts pain.
>
> As Wayne says you want to set up a MRM and then in your
> ~/.m2/settings.xml you activate a profile that points to your MRM.
>
> Again, if you read the books at http://maven.apache.org/articles.html,
> specifically :
> * Maven: The Definitive Guide
> * Better Builds with Maven
>
> You will gain the understanding you need to answer your own questions that
> you have posed on the list.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: noob confusion about dependencies and repositories
Posted by Barrie Treloar <ba...@gmail.com>.
On Sun, Oct 7, 2012 at 7:57 AM, Wayne Fay <wa...@gmail.com> wrote:
>>> > 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?
>
> Most people here run an MRM like Nexus, Artifactory, or Archiva. You
> can find lots of information about these systems at their respective
> sites.
Do not add a repository section to you pom.
That will cause everyone else who uses your artifacts pain.
As Wayne says you want to set up a MRM and then in your
~/.m2/settings.xml you activate a profile that points to your MRM.
Again, if you read the books at http://maven.apache.org/articles.html,
specifically :
* Maven: The Definitive Guide
* Better Builds with Maven
You will gain the understanding you need to answer your own questions
that you have posed on the list.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: noob confusion about dependencies and repositories
Posted by Wayne Fay <wa...@gmail.com>.
>> > 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?
Most people here run an MRM like Nexus, Artifactory, or Archiva. You
can find lots of information about these systems at their respective
sites.
Wayne
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
RE: noob confusion about dependencies and repositories
Posted by Rob Withers <re...@gmail.com>.
> From: Steinar Bang [mailto:sb@dod.no]
> >>>>> "Rob Withers" <re...@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
Re: noob confusion about dependencies and repositories
Posted by Steinar Bang <sb...@dod.no>.
>>>>> "Rob Withers" <re...@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...?).
>> > 3.. Do I need to have a parent pom with two modules, one for each
>> > project?
>>
>> That would be "the maven way", yes, structured so:
>>
>> murmur-top/
>> pom.xml
>> murmur-events/
>> pom.xml
>> murmur/
>> pom.xml
> Ok, I tried this and got an error in both the parent dir, when issuing
> the mvn command:
> C:\rob\comp\workspace>mvn
> [INFO] Scanning for projects...
> [ERROR] The build could not read 3 projects -> [Help 1]
> [ERROR]
> [ERROR] The project org.murmur:murmur-events:1.0.1-SNAPSHOT (C:\rob\comp\workspace\murmur-events\pom.xml) has 1 error
> [ERROR] Non-resolvable parent POM: Could not find artifact org.murmur:murmur-top:pom:1.0-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line
> 5, column 11 -> [Help 2]
Hm... did I do something wrong in my example? I don't think so...?
To try it out, I did "rm -rf ~/.m2/repository/org/murmur" and then "mvn
install" in the top dir again. That worked fine. The output is
attached.
I have also zipped together my banal test project so you can try it out
yourself. I will email it to you. Note: unix line endings.
> [ERROR]
> [ERROR] The project org.murmur:murmur:0.0.1-SNAPSHOT (C:\rob\comp\workspace\murmur\pom.xml) has 1 error
> [ERROR] Non-resolvable parent POM: Could not find artifact org.murmur:murmur-top:pom:1.0-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line
> 4, column 11 -> [Help 2]
Same error... strange... could it be my fake groupId that makes the
problem. What happens if you use the same groupId that your actual
pom.xml files use?
> and an error in the subdir, when issuing the mvn command:
> C:\rob\comp\workspace\murmur-events>mvn
> [INFO] Scanning for projects...
> [ERROR] The build could not read 1 project -> [Help 1]
> [ERROR]
> [ERROR] The project org.murmur:murmur-events:1.0.1-SNAPSHOT (C:\rob\comp\workspace\murmur-events\pom.xml) has 1 error
> [ERROR] Non-resolvable parent POM: Could not find artifact org.murmur:murmur-top:pom:1.0-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line
> 5, column 11 -> [Help 2]
> These are really the same error.
Yep. And with the parent POM residing in the directory above the
projects, this is strange.
>> > 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.
>> > 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.
>> > 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.
> 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.
RE: noob confusion about dependencies and repositories
Posted by Rob Withers <re...@gmail.com>.
Thanks for your response, Steinar...
> From: Steinar Bang [mailto:sb@dod.no]
> >>>>> "Rob Withers" <re...@gmail.com>:
>
> > Here are my questions, I suppose:
> > 1.. How can I install murmur-events, even though pmd/findbugs is
> > issuing warnings? The mvn install is failing.
>
> 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]
> > 3.. Do I need to have a parent pom with two modules, one for each
> > project?
>
> That would be "the maven way", yes, structured so:
>
> murmur-top/
> pom.xml
> murmur-events/
> pom.xml
> murmur/
> pom.xml
Ok, I tried this and got an error in both the parent dir, when issuing the mvn command:
C:\rob\comp\workspace>mvn
[INFO] Scanning for projects...
[ERROR] The build could not read 3 projects -> [Help 1]
[ERROR]
[ERROR] The project org.murmur:murmur-events:1.0.1-SNAPSHOT (C:\rob\comp\workspace\murmur-events\pom.xml) has 1 error
[ERROR] Non-resolvable parent POM: Could not find artifact org.murmur:murmur-top:pom:1.0-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line
5, column 11 -> [Help 2]
[ERROR]
[ERROR] The project org.murmur:murmur:0.0.1-SNAPSHOT (C:\rob\comp\workspace\murmur\pom.xml) has 1 error
[ERROR] Non-resolvable parent POM: Could not find artifact org.murmur:murmur-top:pom:1.0-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line
4, column 11 -> [Help 2]
and an error in the subdir, when issuing the mvn command:
C:\rob\comp\workspace\murmur-events>mvn
[INFO] Scanning for projects...
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project org.murmur:murmur-events:1.0.1-SNAPSHOT (C:\rob\comp\workspace\murmur-events\pom.xml) has 1 error
[ERROR] Non-resolvable parent POM: Could not find artifact org.murmur:murmur-top:pom:1.0-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line
5, column 11 -> [Help 2]
These are really the same error.
> > 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>
> > 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.
> > 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? It does have some level of support, but I am finding I need to go to the command line to generate new projects. 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.
Thanks,
Rob
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: noob confusion about dependencies and repositories
Posted by Steinar Bang <sb...@dod.no>.
>>>>> "Rob Withers" <re...@gmail.com>:
> Here are my questions, I suppose:
> 1.. How can I install murmur-events, even though pmd/findbugs is issuing
> warnings? The mvn install is failing.
What's the directory layout of your projects? Where do you issue the
command? What are the error messages you're getting.
> 2.. Where is the local repository where these get installed?
On a linux/unix'ish machine, it is in $HOME/.m2/repository unless you've
configured it otherwise.
On a Windows XP machine it would typically be
C:\Documents and Settings\yourusername\.m2\repository
On a Vista/Windows 7/Windows 2008 Server and newer, it would typically
be in
C:\users\yourusername\.m2\repository
> 3.. Do I need to have a parent pom with two modules, one for each
> project?
That would be "the maven way", yes, structured so:
murmur-top/
pom.xml
murmur-events/
pom.xml
murmur/
pom.xml
If you structure your project this with POMs like this, you will have
the minimum configuration needed:
murmur-top/pom.xml:
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.murmur</groupId>
<artifactId>murmur-top</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>murmur-top</name>
<modules>
<module>murmur-events</module>
<module>murmur</module>
</modules>
</project>
murmur-top/murmur-events/pom.xml:
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.murmur</groupId>
<artifactId>murmur-top</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>murmur-events</artifactId>
<name>murmur-events</name>
</project>
murmur-top/murmur/pom.xml:
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.murmur</groupId>
<artifactId>murmur-top</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>murmur</artifactId>
<name>murmur</name>
<dependencies>
<dependency>
<groupId>org.murmur</groupId>
<artifactId>murmur-events</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
(I've left out external dependencies such as eg. JUnit for brevity).
To build everything you would do "mvn install" or "mvn clean install"
from the murmur-top directory.
If you go to murmur-top/murmur/ and do "mvn install" from that directory
it will try to resolve the murmur-events dependency from the local
repository ($HOME/.m2/repository) and if the jar isn't there, it will
fail.
If you want to be sure that you are depending on the newest
murmur-events in murmur, you will need to do "mvn install" from the
murmur-top directory.
Note: you don't _have_ to structure your projects like above, but it is
easier that way.
> Does this impact where my local repository is?
Nope.
> 4.. Should I specify the murmur-events-1.0.1-SNAPSHOT.jar, as a dependency
> in the murmur project, by system file path?
No. That is: you probably could, but you definitely should not.
> 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...?
> 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?
> 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.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
RE: noob confusion about dependencies and repositories
Posted by Rob Withers <re...@gmail.com>.
Ok, great. Thanks for the link!
> -----Original Message-----
> From: Barrie Treloar [mailto:baerrach@gmail.com]
> Sent: Saturday, October 06, 2012 6:08 AM
> To: Maven Users List
> Subject: Re: noob confusion about dependencies and repositories
>
> On Sat, Oct 6, 2012 at 11:04 AM, Rob Withers <re...@gmail.com> wrote:
> > Hey y'all,
> >
> > I am trying to link one project's jar to another project. I am
> > totally confused and hope someone can take some time to explain. I
> > have been reading the following pages on the site:
> > http://maven.apache.org/guides/introduction/introduction-to-
> dependency
> > -mechanism.html
> > http://maven.apache.org/guides/getting-
> started/index.html#How_do_I_cre
> > ate_a_JAR_and_install_it_in_my_local_repository
> > http://maven.apache.org/guides/introduction/introduction-to-repositori
> > es.html
>
> Please also have a look at the freely available books at
> http://maven.apache.org/articles.html
>
> They have really good examples and walk you through a simple one artifact
> project to a multi-artifact project.
>
> You will find things will go more smoothly after you have read the first
couple
> of chapters.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: noob confusion about dependencies and repositories
Posted by Barrie Treloar <ba...@gmail.com>.
On Sat, Oct 6, 2012 at 11:04 AM, Rob Withers <re...@gmail.com> wrote:
> Hey y’all,
>
> I am trying to link one project’s jar to another project. I am totally
> confused and hope someone can take some time to explain. I have been
> reading the following pages on the site:
> http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html
> http://maven.apache.org/guides/getting-started/index.html#How_do_I_create_a_JAR_and_install_it_in_my_local_repository
> http://maven.apache.org/guides/introduction/introduction-to-repositories.html
Please also have a look at the freely available books at
http://maven.apache.org/articles.html
They have really good examples and walk you through a simple one
artifact project to a multi-artifact project.
You will find things will go more smoothly after you have read the
first couple of chapters.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org