You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Brain Dump <br...@gmail.com> on 2012/04/10 21:19:25 UTC

DependencyResolutionException when upgrading from Maven 2.2.1 to Maven 3.0.4

Hi everyone,

I'm trying to upgrade my project from Maven 2.2.1 to Maven 3.0.4 but am
running into problems with a dependency resolution. I spent a full day
trying to research this by looking through Maven documentation and similar
posts, but I'm still stuck. I posted on stackoverflow (
http://stackoverflow.com/q/10092772/1324379) but realized that this Maven
User List might be a better place to ask for help. Hope that's okay, and
thanks in advance for your help.

My project structure is as follows:

    pom.xml (acme-parent)
    child-alpha
    +-----> pom.xml

In addition, I have the following files in my own repository:


http://maven.my-own-repo.com/acme/child-dep-jdk15/maven-metadata-local.xml

http://maven.my-own-repo.com/acme/child-dep-jdk15/1.0/child-dep-jdk15-1.0.jar

http://maven.my-own-repo.com/acme/child-dep-jdk15/1.0/child-dep-jdk15-1.0.pom

child-alpha/pom.xml in turn has a profile dependency on my own
acme:child-dep-jdk15, which has been separately built into a jar file and
has its own .pom file specifying a parent that is the same acme-parent
parent as child-alpha.

Here are excerpts from the relevant files:

acme-parent pom.xml:

    <?xml version="1.0" encoding="UTF-8"?>
    <project>
        <modelVersion>4.0.0</modelVersion>
        <groupId>acme</groupId>
        <artifactId>acme-parent</artifactId>
        <name>Acme Parent Project</name>
        <version>1</version>
        <packaging>pom</packaging>

        <properties>...</properties>

        <modules>
            <module>child-alpha</module>
        </modules>

        <repositories>
            <repository>
                <id>acme-repo</id>
                <url>http://maven.my-own-repo.com</url>
            </repository>
            <repository>
                <id>central</id>
                <url>http://repo1.maven.org/maven2</url>
            </repository>
        </repositories>

        <pluginRepositories>...</pluginRepositories>

        <build>
          <plugins>...</plugins>
        </build>

        <dependencies>...</dependencies>
    </project>


child-alpha pom.xml:

    <project>
        <modelVersion>4.0.0</modelVersion>
        <parent>
            <groupId>acme</groupId>
            <artifactId>acme-parent</artifactId>
            <version>1</version>
        </parent>
        <artifactId>child-alpha</artifactId>
        <name>Child Alpha Project</name>
        <version>1.0</version>
        <packaging>jar</packaging>

        <scm>...</scm>

        <properties>...</properties>

        <build>
          <resources>...</resources>
          <plugins>...</plugins>
        </build>

        <profiles>
            <profile>
                <id>jdk15</id>
                <activation>
                    <activeByDefault>true</activeByDefault>
                    <jdk>1.5</jdk>
                </activation>
                <dependencies>
                    <dependency>
                        <groupId>acme</groupId>
                        <artifactId>child-dep-jdk15</artifactId>
                        <version>1.0</version>
                    </dependency>
                </dependencies>
            </profile>
        </profiles>

        <dependencies>...</dependencies>
    </project>


child-dep-jdk15-1.0.pom:

    <project>
        <modelVersion>4.0.0</modelVersion>
        <parent>
            <groupId>acme</groupId>
            <artifactId>acme-parent</artifactId>
            <version>1</version>
        </parent>
        <groupId>acme</groupId>
        <artifactId>child-dep-jdk15</artifactId>
        <name>Acme Child Dependency</name>
        <version>1.0</version>
        <packaging>jar</packaging>

        <build>...</build>

        <dependencies>...</dependencies>
    </project>

When I tried to build child-alpha (while in the child-alpha directory), I
ran the following command:

    mvn -U -e clean install

And I got the following log messages and stack trace (extraneous messages
removed):

    Downloading:
http://maven2.my-own-repo.com/acme/acme-parent/1/acme-parent-1.pom
    Downloading:
http://repo1.maven.org/maven2/acme/acme-parent/1/acme-parent-1.pom

    [...]

    [ERROR] Failed to execute goal on project child-alpha: Could not
resolve dependencies for project acme:child-alpha:jar:1.0: [...]

    Caused by: org.apache.maven.project.DependencyResolutionException:
Could not resolve dependencies for project acme:child-alpha:jar:1.0: [...]

    Caused by:
org.sonatype.aether.collection.DependencyCollectionException: Failed to
collect dependencies for [...]
        at
org.sonatype.aether.impl.internal.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:258)
        at
org.sonatype.aether.impl.internal.DefaultRepositorySystem.collectDependencies(DefaultRepositorySystem.java:308)
        at
org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:150)
        ... 23 more
    Caused by: org.sonatype.aether.resolution.ArtifactDescriptorException:
Failed to read artifact descriptor for acme:child-dep-jdk15:jar:1.0
        at
org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:331)
        at
org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:186)
        at
org.sonatype.aether.impl.internal.DefaultDependencyCollector.process(DefaultDependencyCollector.java:412)
        at
org.sonatype.aether.impl.internal.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:240)
        ... 25 more
    Caused by:
org.apache.maven.model.resolution.UnresolvableModelException: Could not
find artifact acme:acme-parent:pom:1 in acme-repo (
http://maven.my-own-repo.com)
        at
org.apache.maven.repository.internal.DefaultModelResolver.resolveModel(DefaultModelResolver.java:126)
        at
org.apache.maven.model.building.DefaultModelBuilder.readParentExternally(DefaultModelBuilder.java:813)
        at
org.apache.maven.model.building.DefaultModelBuilder.readParent(DefaultModelBuilder.java:664)
        at
org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:310)
        at
org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:232)
        at
org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:322)
        ... 28 more
    Caused by: org.sonatype.aether.resolution.ArtifactResolutionException:
Could not find artifact acme:acme-parent:pom:1 in acme-repo (
http://maven.my-own-repo.com)
        at
org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:538)
        at
org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:216)
        at
org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:193)
        at
org.apache.maven.repository.internal.DefaultModelResolver.resolveModel(DefaultModelResolver.java:122)
        ... 33 more
    Caused by: org.sonatype.aether.transfer.ArtifactNotFoundException:
Could not find artifact acme:acme-parent:pom:1 in acme-repo (
http://maven.my-own-repo.com)
        at
org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap(WagonRepositoryConnector.java:947)
        at
org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap(WagonRepositoryConnector.java:941)
        at
org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.run(WagonRepositoryConnector.java:669)
        at
org.sonatype.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:60)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:680)

While using Maven 2, I've never needed the acme-parent pom.xml at the
following location:
http://maven2.my-own-repo.com/acme/acme-parent/1/acme-parent-1.pom

The reason we don't have the parent pom.xml on our own repo is is that we
have a script used when creating version control branches that changes some
<properties></properties> values in acme-parent pom.xml depending on which
branch we're on, so it would be complicated to put that pom.xml in the repo
and keep it correctly updated for all the different branches we're trying
to build concurrently with our continuous integration server.

In Maven 2, when doing builds of child-alpha, Maven would have no trouble
finding acme-parent pom.xml one directory up, i.e. with a relative path of
../pom.xml, so it would never try going to my repositories to find it.
Having the parent pom.xml in my local checkout only and not having it in
the repo worked fine in Maven 2.

However, when I tried building child-alpha under Maven 3.0.4, the exception
above occurred. At first, I thought I needed to explicitly set the
relativePath within the <parent></parent> tags at the top of child-alpha's
pom.xml, but that didn't fix it -- and acme-parent's pom.xml is indeed
already in the default relativePath of ../pom.xml, so there's no need to
explicitly set it.

Then, I tried commenting out the child-dep-jdk15 dependency within the
<profiles></profiles> section of child-alpha's pom.xml. The child-alpha
maven build completes successfully with this dependency commented out.

I don't understand why child-alpha won't build in Maven 3 when the
child-dep-jdk15 dependency is in place. If Maven was able to correctly find
the acme-parent pom.xml initially (per the <parent></parent> block at the
top), why is it now trying to download it from the repos when processing
the child-dep-jdk15 dependency? Have I configured something incorrectly,
and if so, how should I fix it?

One other thing: if I first run `mvn -N install` in the same directory as
acme-parent's pom.xml, and then try building child-alpha, then the
child-alpha build succeeds, even when keeping the dependency
child-dep-jdk15 in the code. After I run that command, I'm able to verify
acme-parent-1.pom is in my local .m2 directory.  While this workaround may
be okay for individual developers, it'd be a problem for our continuous
integration server, which needs to be able to run concurrent builds for
different branches.

I'd strongly prefer not to have to reconfigure my repository to host the
acme-parent pom.xml due to the version control branching changes I've
mentioned above.

Re: DependencyResolutionException when upgrading from Maven 2.2.1 to Maven 3.0.4

Posted by Stephen Connolly <st...@gmail.com>.
Profiles per-se are “ok”

Adding dependencies in a profile is not.

The problem is when do those profiles get activated, and hence when will
the dependencies get pulled in.

When people have profiles activated by the presence of a file, and then
that pom is resolved from the local repo and not from the checkout... then
the file will not be in ~/.m2/repository/.../.../.../ so the profile will
not be activated, and hence the dependency is lost.

When people have profiles activated by the presence of a system property,
and then the pom is resolved by a different build where the system property
is not defined, the dependency will go missing.

When people have profiles activated by a specific OS or JDK and then you
build e.g. a WAR file that depends on it with one JDK, then the WAR file
will only work for that JDK.

Every time somebody tries adding a dependency via a profile, it comes back
to shoot a downstream consumer of the pom in the ass.

It was a mistake to allow (transitive scoped) <dependencies> in <profile>s
in the first place.

BTW a similar sin is using properties to define dependency coordinates and
using profiles to change those properties.

I suspect non-transitive dependencies (i.e. scope=test or provided) in
profiles *might* have one or two valid use cases... but you would *REALLY*
need to be sure you knew what exactly you were doing and why, and I would
fight tooth and nail to avoid needing to go down that road.

-Stephen

On 11 April 2012 23:22, mike digioia <mp...@gmail.com> wrote:

> Brian,
>
> You can find detail in the manual -
>
> What do we mean by different build environments? Two example build
> environments are production and devel-
> opment. When you are working in a development environment, your system
> might be configured to read from a
> development database instance running on your local machine while in
> production, your system is configured to
> read from the production database. Maven allows you to define any number of
> build environments (build profiles)
> which can override any of the settings in the pom.xml. You could configure
> your application to read from your
> local, development instance of a database in your "development" profile,
> and you can configure it to read from the
> production database in the "production" profile. Profiles can also be
> activated by the environment and platform,
> you can customize a build to run differently depending the Operating System
> or the installed JDK version. Before
> we talk about using and configuring Maven profiles, we need to define the
> concept of Build Portability.
> *********************
>
> I don't see anything wrong with their use to fix the many current issues
> with using this system in very different industry/commercial settings
>
>
> On Wed, Apr 11, 2012 at 2:48 PM, Brain Dump <br...@gmail.com>
> wrote:
>
> > Just to see if it would work, I moved the child-dep-jdk15 dependency out
> of
> > profiles and moved it into <dependencies></dependencies> (outside of
> > profiles). It still fails with the same stack trace. Any idea why? I can
> > get the build to pass if I leave out that dependency altogether, but
> that's
> > not really an option without significant code rewriting.
> >
> > I'm also curious about why including a dependency in a profile is not a
> > good idea (as is using profiles at all). I'm working on a large codebase
> > and would need to explain to the rest of the team before making such
> > changes. Where can I read up on best practices about this?
> >
> > On Wed, Apr 11, 2012 at 1:29 PM, Wayne Fay <wa...@gmail.com> wrote:
> >
> > > > I've managed to do to get the build to succeed is to (1) remove the
> > > > dependency listed within <profiles></profiles> of child-alpha, or (2)
> > > first
> > >
> > > For a ton of reasons, including a dependency in a profile is a really
> > > terrible thing to do. The very first thing I would do would be to
> > > remove it.
> > >
> > > In fact, I'd do everything I could to remove the use of profiles from
> > > your build entirely.
> > >
> > > Wayne
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
> > >
> >
>

Re: DependencyResolutionException when upgrading from Maven 2.2.1 to Maven 3.0.4

Posted by mike digioia <mp...@gmail.com>.
Brian,

You can find detail in the manual -

What do we mean by different build environments? Two example build
environments are production and devel-
opment. When you are working in a development environment, your system
might be configured to read from a
development database instance running on your local machine while in
production, your system is configured to
read from the production database. Maven allows you to define any number of
build environments (build profiles)
which can override any of the settings in the pom.xml. You could configure
your application to read from your
local, development instance of a database in your "development" profile,
and you can configure it to read from the
production database in the "production" profile. Profiles can also be
activated by the environment and platform,
you can customize a build to run differently depending the Operating System
or the installed JDK version. Before
we talk about using and configuring Maven profiles, we need to define the
concept of Build Portability.
*********************

I don't see anything wrong with their use to fix the many current issues
with using this system in very different industry/commercial settings


On Wed, Apr 11, 2012 at 2:48 PM, Brain Dump <br...@gmail.com> wrote:

> Just to see if it would work, I moved the child-dep-jdk15 dependency out of
> profiles and moved it into <dependencies></dependencies> (outside of
> profiles). It still fails with the same stack trace. Any idea why? I can
> get the build to pass if I leave out that dependency altogether, but that's
> not really an option without significant code rewriting.
>
> I'm also curious about why including a dependency in a profile is not a
> good idea (as is using profiles at all). I'm working on a large codebase
> and would need to explain to the rest of the team before making such
> changes. Where can I read up on best practices about this?
>
> On Wed, Apr 11, 2012 at 1:29 PM, Wayne Fay <wa...@gmail.com> wrote:
>
> > > I've managed to do to get the build to succeed is to (1) remove the
> > > dependency listed within <profiles></profiles> of child-alpha, or (2)
> > first
> >
> > For a ton of reasons, including a dependency in a profile is a really
> > terrible thing to do. The very first thing I would do would be to
> > remove it.
> >
> > In fact, I'd do everything I could to remove the use of profiles from
> > your build entirely.
> >
> > Wayne
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>

Re: DependencyResolutionException when upgrading from Maven 2.2.1 to Maven 3.0.4

Posted by Brain Dump <br...@gmail.com>.
Just to see if it would work, I moved the child-dep-jdk15 dependency out of
profiles and moved it into <dependencies></dependencies> (outside of
profiles). It still fails with the same stack trace. Any idea why? I can
get the build to pass if I leave out that dependency altogether, but that's
not really an option without significant code rewriting.

I'm also curious about why including a dependency in a profile is not a
good idea (as is using profiles at all). I'm working on a large codebase
and would need to explain to the rest of the team before making such
changes. Where can I read up on best practices about this?

On Wed, Apr 11, 2012 at 1:29 PM, Wayne Fay <wa...@gmail.com> wrote:

> > I've managed to do to get the build to succeed is to (1) remove the
> > dependency listed within <profiles></profiles> of child-alpha, or (2)
> first
>
> For a ton of reasons, including a dependency in a profile is a really
> terrible thing to do. The very first thing I would do would be to
> remove it.
>
> In fact, I'd do everything I could to remove the use of profiles from
> your build entirely.
>
> Wayne
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: DependencyResolutionException when upgrading from Maven 2.2.1 to Maven 3.0.4

Posted by Wayne Fay <wa...@gmail.com>.
> I've managed to do to get the build to succeed is to (1) remove the
> dependency listed within <profiles></profiles> of child-alpha, or (2) first

For a ton of reasons, including a dependency in a profile is a really
terrible thing to do. The very first thing I would do would be to
remove it.

In fact, I'd do everything I could to remove the use of profiles from
your build entirely.

Wayne

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


Re: DependencyResolutionException when upgrading from Maven 2.2.1 to Maven 3.0.4

Posted by Brain Dump <br...@gmail.com>.
Just want to thank you all -- Stephen, Jörg, Wayne, John, Mike -- for your
help. From your comments, it looks like there are some non-ideal ways my
pom.xml files have been set up. Getting all this fixed up to switch to
Maven 3 is out of scope for our team at the moment, but I'm going to save
all your comments so we have a good starting point when we can get back to
this upgrade. Thanks again for your help.

Re: DependencyResolutionException when upgrading from Maven 2.2.1 to Maven 3.0.4

Posted by Jörg Schaible <Jo...@scalaris.com>.
Hi,

Brain Dump wrote:

> Hey -- sorry about the information overload. I've seen other posts on
> other forums where people posted too little information and were asked to
> post their source code or run something on full debug, etc., so I tried to
> be complete. Didn't mean to overwhelm, and thanks for the responses.
> 
> Simply said, the dependency child-dep-jdk15 was handled without a problem
> in Maven 2.2.1 but its presence causes Maven 3.0.4 to look for the parent
> POM in remote repositories. Both child-alpha and child-dep-jdk15 have the
> same parent. The dependency child-dep-jdk15 was separately compiled and
> available on our own remote repository.
> 
> I did try adding <relativePath>../pom.xml</relativePath> to the parent
> section of child-alpha, and that had no effect. The only two things that
> I've managed to do to get the build to succeed is to (1) remove the
> dependency listed within <profiles></profiles> of child-alpha, or (2)
> first run mvn -N install on the parent first. So it seems that the
> presence of the dependency is what's causing the problem, but I don't
> understand why. (I haven't tried starting from scratch yet.) Neither
> option above is okay because I need that dependency, and running mvn -N
> install would be complicated for branching and our continuous integration
> server.

1/ Your parent is not a SNAPSHOT version (*), therefore M3 might resolve it 
from the repository and ignore any relativePath element.
2/ You seem to define the repository in the POM. Don't do this. M3 might 
ignore these, because you could never really control foreign repositories 
defined in arbitrary POMs. Repositories should be declared in your 
settings.xml.
3/ Because of 1 and 2, M3 might fail to resolve the parent POM.


*) You should never build a non-SNAPSHOT version except when releasing it.

- Jörg


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


Re: DependencyResolutionException when upgrading from Maven 2.2.1 to Maven 3.0.4

Posted by Brain Dump <br...@gmail.com>.
Hey -- sorry about the information overload. I've seen other posts on other
forums where people posted too little information and were asked to post
their source code or run something on full debug, etc., so I tried to be
complete. Didn't mean to overwhelm, and thanks for the responses.

Simply said, the dependency child-dep-jdk15 was handled without a problem
in Maven 2.2.1 but its presence causes Maven 3.0.4 to look for the parent
POM in remote repositories. Both child-alpha and child-dep-jdk15 have the
same parent. The dependency child-dep-jdk15 was separately compiled and
available on our own remote repository.

I did try adding <relativePath>../pom.xml</relativePath> to the parent
section of child-alpha, and that had no effect. The only two things that
I've managed to do to get the build to succeed is to (1) remove the
dependency listed within <profiles></profiles> of child-alpha, or (2) first
run mvn -N install on the parent first. So it seems that the presence of
the dependency is what's causing the problem, but I don't understand why.
(I haven't tried starting from scratch yet.) Neither option above is okay
because I need that dependency, and running mvn -N install would be
complicated for branching and our continuous integration server.

*From: *"Wayne Fay" <wa...@gmail.com>
*To: *"Maven Users List" <us...@maven.apache.org>
*Sent: *Wednesday, April 11, 2012 8:21:44 AM
*Subject: *Re: DependencyResolutionException when upgrading from Maven
2.2.1 to Maven 3.0.4

> Any thoughts from anyone about either Mike's issues, or mine?

Can you boil it down to 5 sentences? I gave up and I'm sure everyone
else did too. Sorry but that was just total information overload.

Wayne

On Wed, Apr 11, 2012 at 8:27 AM, John Patrick <nh...@gmail.com>wrote:

> Or start from scratch with simple pom.xml and nothing in src, then add
> src and fix dependencies, build up slowly then diff the resulting pom
> and see what's different.
>
> On 11 April 2012 16:25, John Patrick <nh...@gmail.com> wrote:
> > If you add
> >
> > <relativePath>../pom.xml</relativePath>
> >
> > Into the parent section of child-alpha, does it resolve any issue your
> > having? Specifically with having to do mvn -N install on the parent
> > 1st.
>

Re: DependencyResolutionException when upgrading from Maven 2.2.1 to Maven 3.0.4

Posted by John Patrick <nh...@gmail.com>.
Or start from scratch with simple pom.xml and nothing in src, then add
src and fix dependencies, build up slowly then diff the resulting pom
and see what's different.

On 11 April 2012 16:25, John Patrick <nh...@gmail.com> wrote:
> If you add
>
> <relativePath>../pom.xml</relativePath>
>
> Into the parent section of child-alpha, does it resolve any issue your
> having? Specifically with having to do mvn -N install on the parent
> 1st.
>
> On 11 April 2012 16:14, Brain Dump <br...@gmail.com> wrote:
>> I was able to compile with no problems on 2.2.1. The only pom.xml changes I
>> had to make to get this (almost) working on 3.0.4 was to add version
>> numbers for plugins that didn't have them specified, move plugins under
>> <reporting></reporting> into <build></build>, and run mvn -N install on the
>> parent pom -- although that's what I'm trying to avoid.
>>
>> I don't know if the issues you're running into are related, or caused by
>> something else.
>>
>> Any thoughts from anyone about either Mike's issues, or mine?
>>
>> Thanks!
>>
>> On Tue, Apr 10, 2012 at 12:37 PM, mike digioia <mp...@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> I just posted a similar issue I am having with the same kind of errors. Did
>>> you ever get this to compile on the 2.2.1? I have built two machines, one
>>> with 2.2.1 and the other one with 3.0.4. I have different problems with
>>> each. Main issue with 3.0.4 is it could not locate some of my dependency
>>> jars. So I copied them from the 2.2.1 release system. But still issues.
>>>
>>> The other main issue is using extension to java/javax with the jmdns.jar.
>>> So I modified the classes inside this jar to avoid the problem but still
>>> have issues. On the 2.2.1 system it does not see my jar, even though it is
>>> inside the pom and was successful with the mvn install-file command.
>>>
>>> On Tue, Apr 10, 2012 at 12:19 PM, Brain Dump <braindump2012@gmail.com
>>> >wrote:
>>>
>>> > Hi everyone,
>>> >
>>> > I'm trying to upgrade my project from Maven 2.2.1 to Maven 3.0.4 but am
>>> > running into problems with a dependency resolution. I spent a full day
>>> > trying to research this by looking through Maven documentation and
>>> similar
>>> > posts, but I'm still stuck. I posted on stackoverflow (
>>> > http://stackoverflow.com/q/10092772/1324379) but realized that this
>>> Maven
>>> > User List might be a better place to ask for help. Hope that's okay, and
>>> > thanks in advance for your help.
>>> >
>>> > My project structure is as follows:
>>> >
>>> >    pom.xml (acme-parent)
>>> >    child-alpha
>>> >    +-----> pom.xml
>>> >
>>> > In addition, I have the following files in my own repository:
>>> >
>>> >
>>> >
>>> http://maven.my-own-repo.com/acme/child-dep-jdk15/maven-metadata-local.xml
>>> >
>>> >
>>> >
>>> http://maven.my-own-repo.com/acme/child-dep-jdk15/1.0/child-dep-jdk15-1.0.jar
>>> >
>>> >
>>> >
>>> http://maven.my-own-repo.com/acme/child-dep-jdk15/1.0/child-dep-jdk15-1.0.pom
>>> >
>>> > child-alpha/pom.xml in turn has a profile dependency on my own
>>> > acme:child-dep-jdk15, which has been separately built into a jar file and
>>> > has its own .pom file specifying a parent that is the same acme-parent
>>> > parent as child-alpha.
>>> >
>>> > Here are excerpts from the relevant files:
>>> >
>>> > acme-parent pom.xml:
>>> >
>>> >    <?xml version="1.0" encoding="UTF-8"?>
>>> >    <project>
>>> >        <modelVersion>4.0.0</modelVersion>
>>> >        <groupId>acme</groupId>
>>> >        <artifactId>acme-parent</artifactId>
>>> >        <name>Acme Parent Project</name>
>>> >        <version>1</version>
>>> >        <packaging>pom</packaging>
>>> >
>>> >        <properties>...</properties>
>>> >
>>> >        <modules>
>>> >            <module>child-alpha</module>
>>> >        </modules>
>>> >
>>> >        <repositories>
>>> >            <repository>
>>> >                <id>acme-repo</id>
>>> >                <url>http://maven.my-own-repo.com</url>
>>> >            </repository>
>>> >            <repository>
>>> >                <id>central</id>
>>> >                <url>http://repo1.maven.org/maven2</url>
>>> >            </repository>
>>> >        </repositories>
>>> >
>>> >        <pluginRepositories>...</pluginRepositories>
>>> >
>>> >        <build>
>>> >          <plugins>...</plugins>
>>> >        </build>
>>> >
>>> >        <dependencies>...</dependencies>
>>> >    </project>
>>> >
>>> >
>>> > child-alpha pom.xml:
>>> >
>>> >    <project>
>>> >        <modelVersion>4.0.0</modelVersion>
>>> >        <parent>
>>> >            <groupId>acme</groupId>
>>> >            <artifactId>acme-parent</artifactId>
>>> >            <version>1</version>
>>> >        </parent>
>>> >        <artifactId>child-alpha</artifactId>
>>> >        <name>Child Alpha Project</name>
>>> >        <version>1.0</version>
>>> >        <packaging>jar</packaging>
>>> >
>>> >        <scm>...</scm>
>>> >
>>> >        <properties>...</properties>
>>> >
>>> >        <build>
>>> >          <resources>...</resources>
>>> >          <plugins>...</plugins>
>>> >        </build>
>>> >
>>> >        <profiles>
>>> >            <profile>
>>> >                <id>jdk15</id>
>>> >                <activation>
>>> >                    <activeByDefault>true</activeByDefault>
>>> >                    <jdk>1.5</jdk>
>>> >                </activation>
>>> >                <dependencies>
>>> >                    <dependency>
>>> >                        <groupId>acme</groupId>
>>> >                        <artifactId>child-dep-jdk15</artifactId>
>>> >                        <version>1.0</version>
>>> >                    </dependency>
>>> >                </dependencies>
>>> >            </profile>
>>> >        </profiles>
>>> >
>>> >        <dependencies>...</dependencies>
>>> >    </project>
>>> >
>>> >
>>> > child-dep-jdk15-1.0.pom:
>>> >
>>> >    <project>
>>> >        <modelVersion>4.0.0</modelVersion>
>>> >        <parent>
>>> >            <groupId>acme</groupId>
>>> >            <artifactId>acme-parent</artifactId>
>>> >            <version>1</version>
>>> >        </parent>
>>> >        <groupId>acme</groupId>
>>> >        <artifactId>child-dep-jdk15</artifactId>
>>> >        <name>Acme Child Dependency</name>
>>> >        <version>1.0</version>
>>> >        <packaging>jar</packaging>
>>> >
>>> >        <build>...</build>
>>> >
>>> >        <dependencies>...</dependencies>
>>> >    </project>
>>> >
>>> > When I tried to build child-alpha (while in the child-alpha directory), I
>>> > ran the following command:
>>> >
>>> >    mvn -U -e clean install
>>> >
>>> > And I got the following log messages and stack trace (extraneous messages
>>> > removed):
>>> >
>>> >    Downloading:
>>> > http://maven2.my-own-repo.com/acme/acme-parent/1/acme-parent-1.pom
>>> >    Downloading:
>>> > http://repo1.maven.org/maven2/acme/acme-parent/1/acme-parent-1.pom
>>> >
>>> >    [...]
>>> >
>>> >    [ERROR] Failed to execute goal on project child-alpha: Could not
>>> > resolve dependencies for project acme:child-alpha:jar:1.0: [...]
>>> >
>>> >    Caused by: org.apache.maven.project.DependencyResolutionException:
>>> > Could not resolve dependencies for project acme:child-alpha:jar:1.0:
>>> [...]
>>> >
>>> >    Caused by:
>>> > org.sonatype.aether.collection.DependencyCollectionException: Failed to
>>> > collect dependencies for [...]
>>> >        at
>>> >
>>> >
>>> org.sonatype.aether.impl.internal.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:258)
>>> >        at
>>> >
>>> >
>>> org.sonatype.aether.impl.internal.DefaultRepositorySystem.collectDependencies(DefaultRepositorySystem.java:308)
>>> >        at
>>> >
>>> >
>>> org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:150)
>>> >        ... 23 more
>>> >    Caused by: org.sonatype.aether.resolution.ArtifactDescriptorException:
>>> > Failed to read artifact descriptor for acme:child-dep-jdk15:jar:1.0
>>> >        at
>>> >
>>> >
>>> org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:331)
>>> >        at
>>> >
>>> >
>>> org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:186)
>>> >        at
>>> >
>>> >
>>> org.sonatype.aether.impl.internal.DefaultDependencyCollector.process(DefaultDependencyCollector.java:412)
>>> >        at
>>> >
>>> >
>>> org.sonatype.aether.impl.internal.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:240)
>>> >        ... 25 more
>>> >    Caused by:
>>> > org.apache.maven.model.resolution.UnresolvableModelException: Could not
>>> > find artifact acme:acme-parent:pom:1 in acme-repo (
>>> > http://maven.my-own-repo.com)
>>> >        at
>>> >
>>> >
>>> org.apache.maven.repository.internal.DefaultModelResolver.resolveModel(DefaultModelResolver.java:126)
>>> >        at
>>> >
>>> >
>>> org.apache.maven.model.building.DefaultModelBuilder.readParentExternally(DefaultModelBuilder.java:813)
>>> >        at
>>> >
>>> >
>>> org.apache.maven.model.building.DefaultModelBuilder.readParent(DefaultModelBuilder.java:664)
>>> >        at
>>> >
>>> >
>>> org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:310)
>>> >        at
>>> >
>>> >
>>> org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:232)
>>> >        at
>>> >
>>> >
>>> org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:322)
>>> >        ... 28 more
>>> >    Caused by: org.sonatype.aether.resolution.ArtifactResolutionException:
>>> > Could not find artifact acme:acme-parent:pom:1 in acme-repo (
>>> > http://maven.my-own-repo.com)
>>> >        at
>>> >
>>> >
>>> org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:538)
>>> >        at
>>> >
>>> >
>>> org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:216)
>>> >        at
>>> >
>>> >
>>> org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:193)
>>> >        at
>>> >
>>> >
>>> org.apache.maven.repository.internal.DefaultModelResolver.resolveModel(DefaultModelResolver.java:122)
>>> >        ... 33 more
>>> >    Caused by: org.sonatype.aether.transfer.ArtifactNotFoundException:
>>> > Could not find artifact acme:acme-parent:pom:1 in acme-repo (
>>> > http://maven.my-own-repo.com)
>>> >        at
>>> >
>>> >
>>> org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap(WagonRepositoryConnector.java:947)
>>> >        at
>>> >
>>> >
>>> org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap(WagonRepositoryConnector.java:941)
>>> >        at
>>> >
>>> >
>>> org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.run(WagonRepositoryConnector.java:669)
>>> >        at
>>> >
>>> >
>>> org.sonatype.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:60)
>>> >        at
>>> >
>>> >
>>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>>> >        at
>>> >
>>> >
>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>>> >        at java.lang.Thread.run(Thread.java:680)
>>> >
>>> > While using Maven 2, I've never needed the acme-parent pom.xml at the
>>> > following location:
>>> > http://maven2.my-own-repo.com/acme/acme-parent/1/acme-parent-1.pom
>>> >
>>> > The reason we don't have the parent pom.xml on our own repo is is that we
>>> > have a script used when creating version control branches that changes
>>> some
>>> > <properties></properties> values in acme-parent pom.xml depending on
>>> which
>>> > branch we're on, so it would be complicated to put that pom.xml in the
>>> repo
>>> > and keep it correctly updated for all the different branches we're trying
>>> > to build concurrently with our continuous integration server.
>>> >
>>> > In Maven 2, when doing builds of child-alpha, Maven would have no trouble
>>> > finding acme-parent pom.xml one directory up, i.e. with a relative path
>>> of
>>> > ../pom.xml, so it would never try going to my repositories to find it.
>>> > Having the parent pom.xml in my local checkout only and not having it in
>>> > the repo worked fine in Maven 2.
>>> >
>>> > However, when I tried building child-alpha under Maven 3.0.4, the
>>> exception
>>> > above occurred. At first, I thought I needed to explicitly set the
>>> > relativePath within the <parent></parent> tags at the top of
>>> child-alpha's
>>> > pom.xml, but that didn't fix it -- and acme-parent's pom.xml is indeed
>>> > already in the default relativePath of ../pom.xml, so there's no need to
>>> > explicitly set it.
>>> >
>>> > Then, I tried commenting out the child-dep-jdk15 dependency within the
>>> > <profiles></profiles> section of child-alpha's pom.xml. The child-alpha
>>> > maven build completes successfully with this dependency commented out.
>>> >
>>> > I don't understand why child-alpha won't build in Maven 3 when the
>>> > child-dep-jdk15 dependency is in place. If Maven was able to correctly
>>> find
>>> > the acme-parent pom.xml initially (per the <parent></parent> block at the
>>> > top), why is it now trying to download it from the repos when processing
>>> > the child-dep-jdk15 dependency? Have I configured something incorrectly,
>>> > and if so, how should I fix it?
>>> >
>>> > One other thing: if I first run `mvn -N install` in the same directory as
>>> > acme-parent's pom.xml, and then try building child-alpha, then the
>>> > child-alpha build succeeds, even when keeping the dependency
>>> > child-dep-jdk15 in the code. After I run that command, I'm able to verify
>>> > acme-parent-1.pom is in my local .m2 directory.  While this workaround
>>> may
>>> > be okay for individual developers, it'd be a problem for our continuous
>>> > integration server, which needs to be able to run concurrent builds for
>>> > different branches.
>>> >
>>> > I'd strongly prefer not to have to reconfigure my repository to host the
>>> > acme-parent pom.xml due to the version control branching changes I've
>>> > mentioned above.
>>> >
>>>

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


Re: DependencyResolutionException when upgrading from Maven 2.2.1 to Maven 3.0.4

Posted by John Patrick <nh...@gmail.com>.
If you add

<relativePath>../pom.xml</relativePath>

Into the parent section of child-alpha, does it resolve any issue your
having? Specifically with having to do mvn -N install on the parent
1st.

On 11 April 2012 16:14, Brain Dump <br...@gmail.com> wrote:
> I was able to compile with no problems on 2.2.1. The only pom.xml changes I
> had to make to get this (almost) working on 3.0.4 was to add version
> numbers for plugins that didn't have them specified, move plugins under
> <reporting></reporting> into <build></build>, and run mvn -N install on the
> parent pom -- although that's what I'm trying to avoid.
>
> I don't know if the issues you're running into are related, or caused by
> something else.
>
> Any thoughts from anyone about either Mike's issues, or mine?
>
> Thanks!
>
> On Tue, Apr 10, 2012 at 12:37 PM, mike digioia <mp...@gmail.com> wrote:
>
>> Hi,
>>
>> I just posted a similar issue I am having with the same kind of errors. Did
>> you ever get this to compile on the 2.2.1? I have built two machines, one
>> with 2.2.1 and the other one with 3.0.4. I have different problems with
>> each. Main issue with 3.0.4 is it could not locate some of my dependency
>> jars. So I copied them from the 2.2.1 release system. But still issues.
>>
>> The other main issue is using extension to java/javax with the jmdns.jar.
>> So I modified the classes inside this jar to avoid the problem but still
>> have issues. On the 2.2.1 system it does not see my jar, even though it is
>> inside the pom and was successful with the mvn install-file command.
>>
>> On Tue, Apr 10, 2012 at 12:19 PM, Brain Dump <braindump2012@gmail.com
>> >wrote:
>>
>> > Hi everyone,
>> >
>> > I'm trying to upgrade my project from Maven 2.2.1 to Maven 3.0.4 but am
>> > running into problems with a dependency resolution. I spent a full day
>> > trying to research this by looking through Maven documentation and
>> similar
>> > posts, but I'm still stuck. I posted on stackoverflow (
>> > http://stackoverflow.com/q/10092772/1324379) but realized that this
>> Maven
>> > User List might be a better place to ask for help. Hope that's okay, and
>> > thanks in advance for your help.
>> >
>> > My project structure is as follows:
>> >
>> >    pom.xml (acme-parent)
>> >    child-alpha
>> >    +-----> pom.xml
>> >
>> > In addition, I have the following files in my own repository:
>> >
>> >
>> >
>> http://maven.my-own-repo.com/acme/child-dep-jdk15/maven-metadata-local.xml
>> >
>> >
>> >
>> http://maven.my-own-repo.com/acme/child-dep-jdk15/1.0/child-dep-jdk15-1.0.jar
>> >
>> >
>> >
>> http://maven.my-own-repo.com/acme/child-dep-jdk15/1.0/child-dep-jdk15-1.0.pom
>> >
>> > child-alpha/pom.xml in turn has a profile dependency on my own
>> > acme:child-dep-jdk15, which has been separately built into a jar file and
>> > has its own .pom file specifying a parent that is the same acme-parent
>> > parent as child-alpha.
>> >
>> > Here are excerpts from the relevant files:
>> >
>> > acme-parent pom.xml:
>> >
>> >    <?xml version="1.0" encoding="UTF-8"?>
>> >    <project>
>> >        <modelVersion>4.0.0</modelVersion>
>> >        <groupId>acme</groupId>
>> >        <artifactId>acme-parent</artifactId>
>> >        <name>Acme Parent Project</name>
>> >        <version>1</version>
>> >        <packaging>pom</packaging>
>> >
>> >        <properties>...</properties>
>> >
>> >        <modules>
>> >            <module>child-alpha</module>
>> >        </modules>
>> >
>> >        <repositories>
>> >            <repository>
>> >                <id>acme-repo</id>
>> >                <url>http://maven.my-own-repo.com</url>
>> >            </repository>
>> >            <repository>
>> >                <id>central</id>
>> >                <url>http://repo1.maven.org/maven2</url>
>> >            </repository>
>> >        </repositories>
>> >
>> >        <pluginRepositories>...</pluginRepositories>
>> >
>> >        <build>
>> >          <plugins>...</plugins>
>> >        </build>
>> >
>> >        <dependencies>...</dependencies>
>> >    </project>
>> >
>> >
>> > child-alpha pom.xml:
>> >
>> >    <project>
>> >        <modelVersion>4.0.0</modelVersion>
>> >        <parent>
>> >            <groupId>acme</groupId>
>> >            <artifactId>acme-parent</artifactId>
>> >            <version>1</version>
>> >        </parent>
>> >        <artifactId>child-alpha</artifactId>
>> >        <name>Child Alpha Project</name>
>> >        <version>1.0</version>
>> >        <packaging>jar</packaging>
>> >
>> >        <scm>...</scm>
>> >
>> >        <properties>...</properties>
>> >
>> >        <build>
>> >          <resources>...</resources>
>> >          <plugins>...</plugins>
>> >        </build>
>> >
>> >        <profiles>
>> >            <profile>
>> >                <id>jdk15</id>
>> >                <activation>
>> >                    <activeByDefault>true</activeByDefault>
>> >                    <jdk>1.5</jdk>
>> >                </activation>
>> >                <dependencies>
>> >                    <dependency>
>> >                        <groupId>acme</groupId>
>> >                        <artifactId>child-dep-jdk15</artifactId>
>> >                        <version>1.0</version>
>> >                    </dependency>
>> >                </dependencies>
>> >            </profile>
>> >        </profiles>
>> >
>> >        <dependencies>...</dependencies>
>> >    </project>
>> >
>> >
>> > child-dep-jdk15-1.0.pom:
>> >
>> >    <project>
>> >        <modelVersion>4.0.0</modelVersion>
>> >        <parent>
>> >            <groupId>acme</groupId>
>> >            <artifactId>acme-parent</artifactId>
>> >            <version>1</version>
>> >        </parent>
>> >        <groupId>acme</groupId>
>> >        <artifactId>child-dep-jdk15</artifactId>
>> >        <name>Acme Child Dependency</name>
>> >        <version>1.0</version>
>> >        <packaging>jar</packaging>
>> >
>> >        <build>...</build>
>> >
>> >        <dependencies>...</dependencies>
>> >    </project>
>> >
>> > When I tried to build child-alpha (while in the child-alpha directory), I
>> > ran the following command:
>> >
>> >    mvn -U -e clean install
>> >
>> > And I got the following log messages and stack trace (extraneous messages
>> > removed):
>> >
>> >    Downloading:
>> > http://maven2.my-own-repo.com/acme/acme-parent/1/acme-parent-1.pom
>> >    Downloading:
>> > http://repo1.maven.org/maven2/acme/acme-parent/1/acme-parent-1.pom
>> >
>> >    [...]
>> >
>> >    [ERROR] Failed to execute goal on project child-alpha: Could not
>> > resolve dependencies for project acme:child-alpha:jar:1.0: [...]
>> >
>> >    Caused by: org.apache.maven.project.DependencyResolutionException:
>> > Could not resolve dependencies for project acme:child-alpha:jar:1.0:
>> [...]
>> >
>> >    Caused by:
>> > org.sonatype.aether.collection.DependencyCollectionException: Failed to
>> > collect dependencies for [...]
>> >        at
>> >
>> >
>> org.sonatype.aether.impl.internal.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:258)
>> >        at
>> >
>> >
>> org.sonatype.aether.impl.internal.DefaultRepositorySystem.collectDependencies(DefaultRepositorySystem.java:308)
>> >        at
>> >
>> >
>> org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:150)
>> >        ... 23 more
>> >    Caused by: org.sonatype.aether.resolution.ArtifactDescriptorException:
>> > Failed to read artifact descriptor for acme:child-dep-jdk15:jar:1.0
>> >        at
>> >
>> >
>> org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:331)
>> >        at
>> >
>> >
>> org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:186)
>> >        at
>> >
>> >
>> org.sonatype.aether.impl.internal.DefaultDependencyCollector.process(DefaultDependencyCollector.java:412)
>> >        at
>> >
>> >
>> org.sonatype.aether.impl.internal.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:240)
>> >        ... 25 more
>> >    Caused by:
>> > org.apache.maven.model.resolution.UnresolvableModelException: Could not
>> > find artifact acme:acme-parent:pom:1 in acme-repo (
>> > http://maven.my-own-repo.com)
>> >        at
>> >
>> >
>> org.apache.maven.repository.internal.DefaultModelResolver.resolveModel(DefaultModelResolver.java:126)
>> >        at
>> >
>> >
>> org.apache.maven.model.building.DefaultModelBuilder.readParentExternally(DefaultModelBuilder.java:813)
>> >        at
>> >
>> >
>> org.apache.maven.model.building.DefaultModelBuilder.readParent(DefaultModelBuilder.java:664)
>> >        at
>> >
>> >
>> org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:310)
>> >        at
>> >
>> >
>> org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:232)
>> >        at
>> >
>> >
>> org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:322)
>> >        ... 28 more
>> >    Caused by: org.sonatype.aether.resolution.ArtifactResolutionException:
>> > Could not find artifact acme:acme-parent:pom:1 in acme-repo (
>> > http://maven.my-own-repo.com)
>> >        at
>> >
>> >
>> org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:538)
>> >        at
>> >
>> >
>> org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:216)
>> >        at
>> >
>> >
>> org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:193)
>> >        at
>> >
>> >
>> org.apache.maven.repository.internal.DefaultModelResolver.resolveModel(DefaultModelResolver.java:122)
>> >        ... 33 more
>> >    Caused by: org.sonatype.aether.transfer.ArtifactNotFoundException:
>> > Could not find artifact acme:acme-parent:pom:1 in acme-repo (
>> > http://maven.my-own-repo.com)
>> >        at
>> >
>> >
>> org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap(WagonRepositoryConnector.java:947)
>> >        at
>> >
>> >
>> org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap(WagonRepositoryConnector.java:941)
>> >        at
>> >
>> >
>> org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.run(WagonRepositoryConnector.java:669)
>> >        at
>> >
>> >
>> org.sonatype.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:60)
>> >        at
>> >
>> >
>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>> >        at
>> >
>> >
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>> >        at java.lang.Thread.run(Thread.java:680)
>> >
>> > While using Maven 2, I've never needed the acme-parent pom.xml at the
>> > following location:
>> > http://maven2.my-own-repo.com/acme/acme-parent/1/acme-parent-1.pom
>> >
>> > The reason we don't have the parent pom.xml on our own repo is is that we
>> > have a script used when creating version control branches that changes
>> some
>> > <properties></properties> values in acme-parent pom.xml depending on
>> which
>> > branch we're on, so it would be complicated to put that pom.xml in the
>> repo
>> > and keep it correctly updated for all the different branches we're trying
>> > to build concurrently with our continuous integration server.
>> >
>> > In Maven 2, when doing builds of child-alpha, Maven would have no trouble
>> > finding acme-parent pom.xml one directory up, i.e. with a relative path
>> of
>> > ../pom.xml, so it would never try going to my repositories to find it.
>> > Having the parent pom.xml in my local checkout only and not having it in
>> > the repo worked fine in Maven 2.
>> >
>> > However, when I tried building child-alpha under Maven 3.0.4, the
>> exception
>> > above occurred. At first, I thought I needed to explicitly set the
>> > relativePath within the <parent></parent> tags at the top of
>> child-alpha's
>> > pom.xml, but that didn't fix it -- and acme-parent's pom.xml is indeed
>> > already in the default relativePath of ../pom.xml, so there's no need to
>> > explicitly set it.
>> >
>> > Then, I tried commenting out the child-dep-jdk15 dependency within the
>> > <profiles></profiles> section of child-alpha's pom.xml. The child-alpha
>> > maven build completes successfully with this dependency commented out.
>> >
>> > I don't understand why child-alpha won't build in Maven 3 when the
>> > child-dep-jdk15 dependency is in place. If Maven was able to correctly
>> find
>> > the acme-parent pom.xml initially (per the <parent></parent> block at the
>> > top), why is it now trying to download it from the repos when processing
>> > the child-dep-jdk15 dependency? Have I configured something incorrectly,
>> > and if so, how should I fix it?
>> >
>> > One other thing: if I first run `mvn -N install` in the same directory as
>> > acme-parent's pom.xml, and then try building child-alpha, then the
>> > child-alpha build succeeds, even when keeping the dependency
>> > child-dep-jdk15 in the code. After I run that command, I'm able to verify
>> > acme-parent-1.pom is in my local .m2 directory.  While this workaround
>> may
>> > be okay for individual developers, it'd be a problem for our continuous
>> > integration server, which needs to be able to run concurrent builds for
>> > different branches.
>> >
>> > I'd strongly prefer not to have to reconfigure my repository to host the
>> > acme-parent pom.xml due to the version control branching changes I've
>> > mentioned above.
>> >
>>

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


Re: DependencyResolutionException when upgrading from Maven 2.2.1 to Maven 3.0.4

Posted by Wayne Fay <wa...@gmail.com>.
> Any thoughts from anyone about either Mike's issues, or mine?

Can you boil it down to 5 sentences? I gave up and I'm sure everyone
else did too. Sorry but that was just total information overload.

Wayne

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


Re: DependencyResolutionException when upgrading from Maven 2.2.1 to Maven 3.0.4

Posted by Brain Dump <br...@gmail.com>.
I was able to compile with no problems on 2.2.1. The only pom.xml changes I
had to make to get this (almost) working on 3.0.4 was to add version
numbers for plugins that didn't have them specified, move plugins under
<reporting></reporting> into <build></build>, and run mvn -N install on the
parent pom -- although that's what I'm trying to avoid.

I don't know if the issues you're running into are related, or caused by
something else.

Any thoughts from anyone about either Mike's issues, or mine?

Thanks!

On Tue, Apr 10, 2012 at 12:37 PM, mike digioia <mp...@gmail.com> wrote:

> Hi,
>
> I just posted a similar issue I am having with the same kind of errors. Did
> you ever get this to compile on the 2.2.1? I have built two machines, one
> with 2.2.1 and the other one with 3.0.4. I have different problems with
> each. Main issue with 3.0.4 is it could not locate some of my dependency
> jars. So I copied them from the 2.2.1 release system. But still issues.
>
> The other main issue is using extension to java/javax with the jmdns.jar.
> So I modified the classes inside this jar to avoid the problem but still
> have issues. On the 2.2.1 system it does not see my jar, even though it is
> inside the pom and was successful with the mvn install-file command.
>
> On Tue, Apr 10, 2012 at 12:19 PM, Brain Dump <braindump2012@gmail.com
> >wrote:
>
> > Hi everyone,
> >
> > I'm trying to upgrade my project from Maven 2.2.1 to Maven 3.0.4 but am
> > running into problems with a dependency resolution. I spent a full day
> > trying to research this by looking through Maven documentation and
> similar
> > posts, but I'm still stuck. I posted on stackoverflow (
> > http://stackoverflow.com/q/10092772/1324379) but realized that this
> Maven
> > User List might be a better place to ask for help. Hope that's okay, and
> > thanks in advance for your help.
> >
> > My project structure is as follows:
> >
> >    pom.xml (acme-parent)
> >    child-alpha
> >    +-----> pom.xml
> >
> > In addition, I have the following files in my own repository:
> >
> >
> >
> http://maven.my-own-repo.com/acme/child-dep-jdk15/maven-metadata-local.xml
> >
> >
> >
> http://maven.my-own-repo.com/acme/child-dep-jdk15/1.0/child-dep-jdk15-1.0.jar
> >
> >
> >
> http://maven.my-own-repo.com/acme/child-dep-jdk15/1.0/child-dep-jdk15-1.0.pom
> >
> > child-alpha/pom.xml in turn has a profile dependency on my own
> > acme:child-dep-jdk15, which has been separately built into a jar file and
> > has its own .pom file specifying a parent that is the same acme-parent
> > parent as child-alpha.
> >
> > Here are excerpts from the relevant files:
> >
> > acme-parent pom.xml:
> >
> >    <?xml version="1.0" encoding="UTF-8"?>
> >    <project>
> >        <modelVersion>4.0.0</modelVersion>
> >        <groupId>acme</groupId>
> >        <artifactId>acme-parent</artifactId>
> >        <name>Acme Parent Project</name>
> >        <version>1</version>
> >        <packaging>pom</packaging>
> >
> >        <properties>...</properties>
> >
> >        <modules>
> >            <module>child-alpha</module>
> >        </modules>
> >
> >        <repositories>
> >            <repository>
> >                <id>acme-repo</id>
> >                <url>http://maven.my-own-repo.com</url>
> >            </repository>
> >            <repository>
> >                <id>central</id>
> >                <url>http://repo1.maven.org/maven2</url>
> >            </repository>
> >        </repositories>
> >
> >        <pluginRepositories>...</pluginRepositories>
> >
> >        <build>
> >          <plugins>...</plugins>
> >        </build>
> >
> >        <dependencies>...</dependencies>
> >    </project>
> >
> >
> > child-alpha pom.xml:
> >
> >    <project>
> >        <modelVersion>4.0.0</modelVersion>
> >        <parent>
> >            <groupId>acme</groupId>
> >            <artifactId>acme-parent</artifactId>
> >            <version>1</version>
> >        </parent>
> >        <artifactId>child-alpha</artifactId>
> >        <name>Child Alpha Project</name>
> >        <version>1.0</version>
> >        <packaging>jar</packaging>
> >
> >        <scm>...</scm>
> >
> >        <properties>...</properties>
> >
> >        <build>
> >          <resources>...</resources>
> >          <plugins>...</plugins>
> >        </build>
> >
> >        <profiles>
> >            <profile>
> >                <id>jdk15</id>
> >                <activation>
> >                    <activeByDefault>true</activeByDefault>
> >                    <jdk>1.5</jdk>
> >                </activation>
> >                <dependencies>
> >                    <dependency>
> >                        <groupId>acme</groupId>
> >                        <artifactId>child-dep-jdk15</artifactId>
> >                        <version>1.0</version>
> >                    </dependency>
> >                </dependencies>
> >            </profile>
> >        </profiles>
> >
> >        <dependencies>...</dependencies>
> >    </project>
> >
> >
> > child-dep-jdk15-1.0.pom:
> >
> >    <project>
> >        <modelVersion>4.0.0</modelVersion>
> >        <parent>
> >            <groupId>acme</groupId>
> >            <artifactId>acme-parent</artifactId>
> >            <version>1</version>
> >        </parent>
> >        <groupId>acme</groupId>
> >        <artifactId>child-dep-jdk15</artifactId>
> >        <name>Acme Child Dependency</name>
> >        <version>1.0</version>
> >        <packaging>jar</packaging>
> >
> >        <build>...</build>
> >
> >        <dependencies>...</dependencies>
> >    </project>
> >
> > When I tried to build child-alpha (while in the child-alpha directory), I
> > ran the following command:
> >
> >    mvn -U -e clean install
> >
> > And I got the following log messages and stack trace (extraneous messages
> > removed):
> >
> >    Downloading:
> > http://maven2.my-own-repo.com/acme/acme-parent/1/acme-parent-1.pom
> >    Downloading:
> > http://repo1.maven.org/maven2/acme/acme-parent/1/acme-parent-1.pom
> >
> >    [...]
> >
> >    [ERROR] Failed to execute goal on project child-alpha: Could not
> > resolve dependencies for project acme:child-alpha:jar:1.0: [...]
> >
> >    Caused by: org.apache.maven.project.DependencyResolutionException:
> > Could not resolve dependencies for project acme:child-alpha:jar:1.0:
> [...]
> >
> >    Caused by:
> > org.sonatype.aether.collection.DependencyCollectionException: Failed to
> > collect dependencies for [...]
> >        at
> >
> >
> org.sonatype.aether.impl.internal.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:258)
> >        at
> >
> >
> org.sonatype.aether.impl.internal.DefaultRepositorySystem.collectDependencies(DefaultRepositorySystem.java:308)
> >        at
> >
> >
> org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:150)
> >        ... 23 more
> >    Caused by: org.sonatype.aether.resolution.ArtifactDescriptorException:
> > Failed to read artifact descriptor for acme:child-dep-jdk15:jar:1.0
> >        at
> >
> >
> org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:331)
> >        at
> >
> >
> org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:186)
> >        at
> >
> >
> org.sonatype.aether.impl.internal.DefaultDependencyCollector.process(DefaultDependencyCollector.java:412)
> >        at
> >
> >
> org.sonatype.aether.impl.internal.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:240)
> >        ... 25 more
> >    Caused by:
> > org.apache.maven.model.resolution.UnresolvableModelException: Could not
> > find artifact acme:acme-parent:pom:1 in acme-repo (
> > http://maven.my-own-repo.com)
> >        at
> >
> >
> org.apache.maven.repository.internal.DefaultModelResolver.resolveModel(DefaultModelResolver.java:126)
> >        at
> >
> >
> org.apache.maven.model.building.DefaultModelBuilder.readParentExternally(DefaultModelBuilder.java:813)
> >        at
> >
> >
> org.apache.maven.model.building.DefaultModelBuilder.readParent(DefaultModelBuilder.java:664)
> >        at
> >
> >
> org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:310)
> >        at
> >
> >
> org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:232)
> >        at
> >
> >
> org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:322)
> >        ... 28 more
> >    Caused by: org.sonatype.aether.resolution.ArtifactResolutionException:
> > Could not find artifact acme:acme-parent:pom:1 in acme-repo (
> > http://maven.my-own-repo.com)
> >        at
> >
> >
> org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:538)
> >        at
> >
> >
> org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:216)
> >        at
> >
> >
> org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:193)
> >        at
> >
> >
> org.apache.maven.repository.internal.DefaultModelResolver.resolveModel(DefaultModelResolver.java:122)
> >        ... 33 more
> >    Caused by: org.sonatype.aether.transfer.ArtifactNotFoundException:
> > Could not find artifact acme:acme-parent:pom:1 in acme-repo (
> > http://maven.my-own-repo.com)
> >        at
> >
> >
> org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap(WagonRepositoryConnector.java:947)
> >        at
> >
> >
> org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap(WagonRepositoryConnector.java:941)
> >        at
> >
> >
> org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.run(WagonRepositoryConnector.java:669)
> >        at
> >
> >
> org.sonatype.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:60)
> >        at
> >
> >
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> >        at
> >
> >
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> >        at java.lang.Thread.run(Thread.java:680)
> >
> > While using Maven 2, I've never needed the acme-parent pom.xml at the
> > following location:
> > http://maven2.my-own-repo.com/acme/acme-parent/1/acme-parent-1.pom
> >
> > The reason we don't have the parent pom.xml on our own repo is is that we
> > have a script used when creating version control branches that changes
> some
> > <properties></properties> values in acme-parent pom.xml depending on
> which
> > branch we're on, so it would be complicated to put that pom.xml in the
> repo
> > and keep it correctly updated for all the different branches we're trying
> > to build concurrently with our continuous integration server.
> >
> > In Maven 2, when doing builds of child-alpha, Maven would have no trouble
> > finding acme-parent pom.xml one directory up, i.e. with a relative path
> of
> > ../pom.xml, so it would never try going to my repositories to find it.
> > Having the parent pom.xml in my local checkout only and not having it in
> > the repo worked fine in Maven 2.
> >
> > However, when I tried building child-alpha under Maven 3.0.4, the
> exception
> > above occurred. At first, I thought I needed to explicitly set the
> > relativePath within the <parent></parent> tags at the top of
> child-alpha's
> > pom.xml, but that didn't fix it -- and acme-parent's pom.xml is indeed
> > already in the default relativePath of ../pom.xml, so there's no need to
> > explicitly set it.
> >
> > Then, I tried commenting out the child-dep-jdk15 dependency within the
> > <profiles></profiles> section of child-alpha's pom.xml. The child-alpha
> > maven build completes successfully with this dependency commented out.
> >
> > I don't understand why child-alpha won't build in Maven 3 when the
> > child-dep-jdk15 dependency is in place. If Maven was able to correctly
> find
> > the acme-parent pom.xml initially (per the <parent></parent> block at the
> > top), why is it now trying to download it from the repos when processing
> > the child-dep-jdk15 dependency? Have I configured something incorrectly,
> > and if so, how should I fix it?
> >
> > One other thing: if I first run `mvn -N install` in the same directory as
> > acme-parent's pom.xml, and then try building child-alpha, then the
> > child-alpha build succeeds, even when keeping the dependency
> > child-dep-jdk15 in the code. After I run that command, I'm able to verify
> > acme-parent-1.pom is in my local .m2 directory.  While this workaround
> may
> > be okay for individual developers, it'd be a problem for our continuous
> > integration server, which needs to be able to run concurrent builds for
> > different branches.
> >
> > I'd strongly prefer not to have to reconfigure my repository to host the
> > acme-parent pom.xml due to the version control branching changes I've
> > mentioned above.
> >
>

Re: DependencyResolutionException when upgrading from Maven 2.2.1 to Maven 3.0.4

Posted by mike digioia <mp...@gmail.com>.
Hi,

I just posted a similar issue I am having with the same kind of errors. Did
you ever get this to compile on the 2.2.1? I have built two machines, one
with 2.2.1 and the other one with 3.0.4. I have different problems with
each. Main issue with 3.0.4 is it could not locate some of my dependency
jars. So I copied them from the 2.2.1 release system. But still issues.

The other main issue is using extension to java/javax with the jmdns.jar.
So I modified the classes inside this jar to avoid the problem but still
have issues. On the 2.2.1 system it does not see my jar, even though it is
inside the pom and was successful with the mvn install-file command.

On Tue, Apr 10, 2012 at 12:19 PM, Brain Dump <br...@gmail.com>wrote:

> Hi everyone,
>
> I'm trying to upgrade my project from Maven 2.2.1 to Maven 3.0.4 but am
> running into problems with a dependency resolution. I spent a full day
> trying to research this by looking through Maven documentation and similar
> posts, but I'm still stuck. I posted on stackoverflow (
> http://stackoverflow.com/q/10092772/1324379) but realized that this Maven
> User List might be a better place to ask for help. Hope that's okay, and
> thanks in advance for your help.
>
> My project structure is as follows:
>
>    pom.xml (acme-parent)
>    child-alpha
>    +-----> pom.xml
>
> In addition, I have the following files in my own repository:
>
>
> http://maven.my-own-repo.com/acme/child-dep-jdk15/maven-metadata-local.xml
>
>
> http://maven.my-own-repo.com/acme/child-dep-jdk15/1.0/child-dep-jdk15-1.0.jar
>
>
> http://maven.my-own-repo.com/acme/child-dep-jdk15/1.0/child-dep-jdk15-1.0.pom
>
> child-alpha/pom.xml in turn has a profile dependency on my own
> acme:child-dep-jdk15, which has been separately built into a jar file and
> has its own .pom file specifying a parent that is the same acme-parent
> parent as child-alpha.
>
> Here are excerpts from the relevant files:
>
> acme-parent pom.xml:
>
>    <?xml version="1.0" encoding="UTF-8"?>
>    <project>
>        <modelVersion>4.0.0</modelVersion>
>        <groupId>acme</groupId>
>        <artifactId>acme-parent</artifactId>
>        <name>Acme Parent Project</name>
>        <version>1</version>
>        <packaging>pom</packaging>
>
>        <properties>...</properties>
>
>        <modules>
>            <module>child-alpha</module>
>        </modules>
>
>        <repositories>
>            <repository>
>                <id>acme-repo</id>
>                <url>http://maven.my-own-repo.com</url>
>            </repository>
>            <repository>
>                <id>central</id>
>                <url>http://repo1.maven.org/maven2</url>
>            </repository>
>        </repositories>
>
>        <pluginRepositories>...</pluginRepositories>
>
>        <build>
>          <plugins>...</plugins>
>        </build>
>
>        <dependencies>...</dependencies>
>    </project>
>
>
> child-alpha pom.xml:
>
>    <project>
>        <modelVersion>4.0.0</modelVersion>
>        <parent>
>            <groupId>acme</groupId>
>            <artifactId>acme-parent</artifactId>
>            <version>1</version>
>        </parent>
>        <artifactId>child-alpha</artifactId>
>        <name>Child Alpha Project</name>
>        <version>1.0</version>
>        <packaging>jar</packaging>
>
>        <scm>...</scm>
>
>        <properties>...</properties>
>
>        <build>
>          <resources>...</resources>
>          <plugins>...</plugins>
>        </build>
>
>        <profiles>
>            <profile>
>                <id>jdk15</id>
>                <activation>
>                    <activeByDefault>true</activeByDefault>
>                    <jdk>1.5</jdk>
>                </activation>
>                <dependencies>
>                    <dependency>
>                        <groupId>acme</groupId>
>                        <artifactId>child-dep-jdk15</artifactId>
>                        <version>1.0</version>
>                    </dependency>
>                </dependencies>
>            </profile>
>        </profiles>
>
>        <dependencies>...</dependencies>
>    </project>
>
>
> child-dep-jdk15-1.0.pom:
>
>    <project>
>        <modelVersion>4.0.0</modelVersion>
>        <parent>
>            <groupId>acme</groupId>
>            <artifactId>acme-parent</artifactId>
>            <version>1</version>
>        </parent>
>        <groupId>acme</groupId>
>        <artifactId>child-dep-jdk15</artifactId>
>        <name>Acme Child Dependency</name>
>        <version>1.0</version>
>        <packaging>jar</packaging>
>
>        <build>...</build>
>
>        <dependencies>...</dependencies>
>    </project>
>
> When I tried to build child-alpha (while in the child-alpha directory), I
> ran the following command:
>
>    mvn -U -e clean install
>
> And I got the following log messages and stack trace (extraneous messages
> removed):
>
>    Downloading:
> http://maven2.my-own-repo.com/acme/acme-parent/1/acme-parent-1.pom
>    Downloading:
> http://repo1.maven.org/maven2/acme/acme-parent/1/acme-parent-1.pom
>
>    [...]
>
>    [ERROR] Failed to execute goal on project child-alpha: Could not
> resolve dependencies for project acme:child-alpha:jar:1.0: [...]
>
>    Caused by: org.apache.maven.project.DependencyResolutionException:
> Could not resolve dependencies for project acme:child-alpha:jar:1.0: [...]
>
>    Caused by:
> org.sonatype.aether.collection.DependencyCollectionException: Failed to
> collect dependencies for [...]
>        at
>
> org.sonatype.aether.impl.internal.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:258)
>        at
>
> org.sonatype.aether.impl.internal.DefaultRepositorySystem.collectDependencies(DefaultRepositorySystem.java:308)
>        at
>
> org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:150)
>        ... 23 more
>    Caused by: org.sonatype.aether.resolution.ArtifactDescriptorException:
> Failed to read artifact descriptor for acme:child-dep-jdk15:jar:1.0
>        at
>
> org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:331)
>        at
>
> org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:186)
>        at
>
> org.sonatype.aether.impl.internal.DefaultDependencyCollector.process(DefaultDependencyCollector.java:412)
>        at
>
> org.sonatype.aether.impl.internal.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:240)
>        ... 25 more
>    Caused by:
> org.apache.maven.model.resolution.UnresolvableModelException: Could not
> find artifact acme:acme-parent:pom:1 in acme-repo (
> http://maven.my-own-repo.com)
>        at
>
> org.apache.maven.repository.internal.DefaultModelResolver.resolveModel(DefaultModelResolver.java:126)
>        at
>
> org.apache.maven.model.building.DefaultModelBuilder.readParentExternally(DefaultModelBuilder.java:813)
>        at
>
> org.apache.maven.model.building.DefaultModelBuilder.readParent(DefaultModelBuilder.java:664)
>        at
>
> org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:310)
>        at
>
> org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:232)
>        at
>
> org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:322)
>        ... 28 more
>    Caused by: org.sonatype.aether.resolution.ArtifactResolutionException:
> Could not find artifact acme:acme-parent:pom:1 in acme-repo (
> http://maven.my-own-repo.com)
>        at
>
> org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:538)
>        at
>
> org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:216)
>        at
>
> org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:193)
>        at
>
> org.apache.maven.repository.internal.DefaultModelResolver.resolveModel(DefaultModelResolver.java:122)
>        ... 33 more
>    Caused by: org.sonatype.aether.transfer.ArtifactNotFoundException:
> Could not find artifact acme:acme-parent:pom:1 in acme-repo (
> http://maven.my-own-repo.com)
>        at
>
> org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap(WagonRepositoryConnector.java:947)
>        at
>
> org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap(WagonRepositoryConnector.java:941)
>        at
>
> org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.run(WagonRepositoryConnector.java:669)
>        at
>
> org.sonatype.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:60)
>        at
>
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>        at
>
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>        at java.lang.Thread.run(Thread.java:680)
>
> While using Maven 2, I've never needed the acme-parent pom.xml at the
> following location:
> http://maven2.my-own-repo.com/acme/acme-parent/1/acme-parent-1.pom
>
> The reason we don't have the parent pom.xml on our own repo is is that we
> have a script used when creating version control branches that changes some
> <properties></properties> values in acme-parent pom.xml depending on which
> branch we're on, so it would be complicated to put that pom.xml in the repo
> and keep it correctly updated for all the different branches we're trying
> to build concurrently with our continuous integration server.
>
> In Maven 2, when doing builds of child-alpha, Maven would have no trouble
> finding acme-parent pom.xml one directory up, i.e. with a relative path of
> ../pom.xml, so it would never try going to my repositories to find it.
> Having the parent pom.xml in my local checkout only and not having it in
> the repo worked fine in Maven 2.
>
> However, when I tried building child-alpha under Maven 3.0.4, the exception
> above occurred. At first, I thought I needed to explicitly set the
> relativePath within the <parent></parent> tags at the top of child-alpha's
> pom.xml, but that didn't fix it -- and acme-parent's pom.xml is indeed
> already in the default relativePath of ../pom.xml, so there's no need to
> explicitly set it.
>
> Then, I tried commenting out the child-dep-jdk15 dependency within the
> <profiles></profiles> section of child-alpha's pom.xml. The child-alpha
> maven build completes successfully with this dependency commented out.
>
> I don't understand why child-alpha won't build in Maven 3 when the
> child-dep-jdk15 dependency is in place. If Maven was able to correctly find
> the acme-parent pom.xml initially (per the <parent></parent> block at the
> top), why is it now trying to download it from the repos when processing
> the child-dep-jdk15 dependency? Have I configured something incorrectly,
> and if so, how should I fix it?
>
> One other thing: if I first run `mvn -N install` in the same directory as
> acme-parent's pom.xml, and then try building child-alpha, then the
> child-alpha build succeeds, even when keeping the dependency
> child-dep-jdk15 in the code. After I run that command, I'm able to verify
> acme-parent-1.pom is in my local .m2 directory.  While this workaround may
> be okay for individual developers, it'd be a problem for our continuous
> integration server, which needs to be able to run concurrent builds for
> different branches.
>
> I'd strongly prefer not to have to reconfigure my repository to host the
> acme-parent pom.xml due to the version control branching changes I've
> mentioned above.
>