On 16 August 2010 15:16, janne postilista <[email protected]>wrote:

> Heh. Not the first headache I have with this plugin...
>
> I'm curious, care to briefly explain what's the fundamental problem
> with maven-glassfish-plugin....why is having a plugin that depends on
> another plugin a problem?
>

In Maven 2.x the first time a plugin is resolved, that version is the only
version that is ever resolved, so when you have a dependency on another
maven-plugin if a different version is used in a module earlier in the
reactor, then you will not get the version you expect and all hell will
break loose.

The solution is to move the plugin heavy lifting code into a separate module
(jar type) and then depend on that


>
> Does this somehow explain the mystery why the version range gets resolved
> in
> my windows environment but not in linux, or is this a separate issue?
>
>
I don't think so

On Mon, Aug 16, 2010 at 5:10 PM, Stephen Connolly <
> [email protected]> wrote:
>
> > Ohhhhhhh!!!
> >
> > You're using maven-glassfish-plugin.... well that explains it.
> >
> > Here is the golden rule.
> >
> > Friends don't let friends use the java.net maven repositories...
> >
> > Here is another bad example, they have a plugin that depends on another
> > plugin... which will mess up big big big time unless you are using Maven
> 3
> > (and even then its a bad plan)
> >
> > -Stephen
> >
> > On 16 August 2010 15:06, janne postilista <[email protected]
> > >wrote:
> >
> > > Thanks for the suggestion. This cured my build:
> > >
> > >                <plugin>
> > >                    <groupId>org.glassfish.maven.plugin</groupId>
> > >                    <artifactId>maven-glassfish-plugin</artifactId>
> > >                    <version>2.1</version>
> > >                    <configuration>...
> > >                    </configuration>
> > >                    <dependencies>
> > >                        <dependency>
> > >                            <groupId>au.net.ocean.maven.plugin</groupId>
> > >                            <artifactId>maven-plugin</artifactId>
> > >                            <version>1.0</version>
> > >                            <exclusions>
> > >                                <exclusion>
> > >                                     <groupId>org.apache.maven</groupId>
> > >
> > >  <artifactId>maven-plugin-api</artifactId>
> > >                                 </exclusion>
> > >                            </exclusions>
> > >                        </dependency>
> > >                         <dependency>
> > >                            <groupId>org.apache.maven</groupId>
> > >                            <artifactId>maven-plugin-api</artifactId>
> > >                            <version>2.0</version>
> > >                         </dependency>
> > >                    </dependencies>
> > >                </plugin>
> > >
> > > Needless to say, this is ugly and it would be really really nice to
> find
> > > out
> > > why version matching does not work on the linux maven build, when it
> does
> > > work on the windows build.
> > >
> > >
> > > On Mon, Aug 16, 2010 at 5:03 PM, Stephen Connolly <
> > > [email protected]> wrote:
> > >
> > > > you define the exclusions on your dependencies and that will purge
> them
> > > > from
> > > > your entire dependency tree
> > > >
> > > > On 16 August 2010 14:49, janne postilista <
> [email protected]
> > > > >wrote:
> > > >
> > > > > I'm not sure what that means exactly?
> > > > >
> > > > > The problem is nested a few levels down in my dependencies:
> > > > >
> > > > > my webapp -> maven-glassfish-plugin -> maven-plugin ->
> > maven-plugin-api
> > > > >
> > > > > maven-plugin's pom.xml has the problematic reference to
> > > maven-plugin-api
> > > > > version [2.0,)
> > > > >
> > > > > Is your suggestion still usable in this scenario? Can I define
> > > exclusions
> > > > > to
> > > > > my dependencies dependencies?
> > > > >
> > > > >
> > > > >
> > > > > On Mon, Aug 16, 2010 at 4:44 PM, Stephen Connolly <
> > > > > [email protected]> wrote:
> > > > >
> > > > > > have you considered using exclusions to knock out the problematic
> > > > > > transitive
> > > > > > dep and then add in a corrected version for your own project
> > > > > >
> > > > > > On 16 August 2010 14:41, janne postilista <
> > > [email protected]
> > > > > > >wrote:
> > > > > >
> > > > > > > It's not the solution I want, but can I somehow tell in my
> > pom.xml
> > > > > > > that if a dependency has defined it's own dependency as:
> > > > > > >
> > > > > > >      <dependency>
> > > > > > >          <groupId>org.apache.maven</groupId>
> > > > > > >          <artifactId>maven-plugin-api</artifactId>
> > > > > > >          <version>[2.0,)</version>
> > > > > > >          <scope>compile</scope>
> > > > > > >      </dependency>
> > > > > > >
> > > > > > > FORCE it to use 2.0 exactly?
> > > > > > >
> > > > > > > Tried adding to my pom.xml:
> > > > > > >
> > > > > > >    <dependencyManagement>
> > > > > > >        <dependencies>
> > > > > > >             <dependency>
> > > > > > >                <groupId>org.apache.maven</groupId>
> > > > > > >                <artifactId>maven-plugin-api</artifactId>
> > > > > > >                <version>2.0</version>
> > > > > > >                <scope>compile</scope>
> > > > > > >            </dependency>
> > > > > > >         </dependencies>
> > > > > > >    </dependencyManagement>
> > > > > > >
> > > > > > > but it was of no help.
> > > > > > >
> > > > > > > On Mon, Aug 16, 2010 at 4:29 PM, janne postilista
> > > > > > > <[email protected]> wrote:
> > > > > > > > And when I change my direct dependency in pom.xml
> > > > > > > >
> > > > > > > > from
> > > > > > > >
> > > > > > > >       <dependency>
> > > > > > > >           <groupId>org.apache.maven</groupId>
> > > > > > > >           <artifactId>maven-plugin-api</artifactId>
> > > > > > > >           <version>[2.0,)</version>
> > > > > > > >           <scope>compile</scope>
> > > > > > > >       </dependency>
> > > > > > > >
> > > > > > > > to
> > > > > > > >
> > > > > > > >       <dependency>
> > > > > > > >           <groupId>org.apache.maven</groupId>
> > > > > > > >           <artifactId>maven-plugin-api</artifactId>
> > > > > > > >           <version>2.0</version>
> > > > > > > >           <scope>compile</scope>
> > > > > > > >       </dependency>
> > > > > > > >
> > > > > > > > linux build finds the dependency from the repository fine. So
> > it
> > > > > seems
> > > > > > > that
> > > > > > > >
> > > > > > > > - linux maven for some reason cannot resolve
> > > > > <version>[2.0,)</version>
> > > > > > > > - windows maven can resolve <version>[2.0,)</version>
> > > > > > > >
> > > > > > > > Maven versions:
> > > > > > > >
> > > > > > > > C:\Windows\System32>mvn --version
> > > > > > > > Apache Maven 2.2.1 (r801777; 2009-08-06 22:16:01+0300)
> > > > > > > > Java version: 1.6.0_14
> > > > > > > > Java home: C:\Program Files (x86)\Java\jdk1.6.0_14\jre
> > > > > > > > Default locale: fi_FI, platform encoding: Cp1252
> > > > > > > > OS name: "windows vista" version: "6.0" arch: "x86" Family:
> > > > "windows"
> > > > > > > >
> > > > > > > > ]$ mvn --version
> > > > > > > > Apache Maven 2.2.1 (r801777; 2009-08-06 22:16:01+0300)
> > > > > > > > Java version: 1.6.0_21
> > > > > > > > Java home: /usr/java/jdk1.6.0_21/jre
> > > > > > > > Default locale: en_US, platform encoding: UTF-8
> > > > > > > > OS name: "linux" version: "2.6.18-194.8.1.el5" arch: "amd64"
> > > > Family:
> > > > > > > "unix"
> > > > > > > >
> > > > > > > >
> > > > > > > > On Mon, Aug 16, 2010 at 4:24 PM, janne postilista
> > > > > > > > <[email protected]> wrote:
> > > > > > > >> Thanks, but it doesn't seem to be a Hudson issue.
> > > > > > > >>
> > > > > > > >> Installed maven 2.2.1 (same as my local windows version) to
> > the
> > > > > linux
> > > > > > > >> machine and trying the same build from there, I get:
> > > > > > > >>
> > > > > > > >> [INFO]
> > > > > > >
> > > > >
> > >
> ------------------------------------------------------------------------
> > > > > > > >> [ERROR] BUILD ERROR
> > > > > > > >> [INFO]
> > > > > > >
> > > > >
> > >
> ------------------------------------------------------------------------
> > > > > > > >> [INFO] Failed to resolve artifact.
> > > > > > > >>
> > > > > > > >> No versions are present in the repository for the artifact
> > with
> > > a
> > > > > > range
> > > > > > > [2.0,)
> > > > > > > >>  org.apache.maven:maven-plugin-api:jar:null
> > > > > > > >>
> > > > > > > >> from the specified remote repositories:
> > > > > > > >>  central (http://repo1.maven.org/maven2),
> > > > > > > >>  prime-repo (http://repository.prime.com.tr)
> > > > > > > >>
> > > > > > > >> Path to dependency:
> > > > > > > >>        1) zzz:webapp:war:1.0-SNAPSHOT
> > > > > > > >>
> > > > > > > >> I can't figure out why the same build fails on the linux box
> > and
> > > > > works
> > > > > > > >> on my windows environment...I have tried telnetting
> > > > repo1.maven.org
> > > > > > > >> successfully.
> > > > > > > >>
> > > > > > > >>
> > > > > > > >> On Mon, Aug 16, 2010 at 3:45 PM, Stephen Connolly
> > > > > > > >> <[email protected]> wrote:
> > > > > > > >>> 1. This is a hudson issue so report on the hudson list.
> > > > > > > >>>
> > > > > > > >>> On 16 August 2010 12:54, janne postilista <
> > > > > > [email protected]
> > > > > > > >wrote:
> > > > > > > >>>
> > > > > > > >>>> My build craps out because
> > > > > > > >>>>
> > > > > > > >>>> [HUDSON] Archiving
> > > > > > > >>>>
> > /home/zzz/.hudson/jobs/ci-build/workspace/trunk/webapp/pom.xml
> > > > to
> > > > > > > >>>>
> > > > > > > >>>>
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> /home/zzz/.hudson/jobs/ci-build/modules/zzz$webapp/builds/2010-08-16_14-27-53/archive/zzz/webapp/1.0-SNAPSHOT/pom.xml
> > > > > > > >>>> [INFO]
> > > > > > > >>>>
> > > > > > >
> > > > >
> > >
> ------------------------------------------------------------------------
> > > > > > > >>>> [ERROR] BUILD ERROR
> > > > > > > >>>> [INFO]
> > > > > > > >>>>
> > > > > > >
> > > > >
> > >
> ------------------------------------------------------------------------
> > > > > > > >>>> [INFO] Failed to resolve artifact.
> > > > > > > >>>>
> > > > > > > >>>> No versions are present in the repository for the artifact
> > > with
> > > > a
> > > > > > > range
> > > > > > > >>>> [2.0,)
> > > > > > > >>>>  org.apache.maven:maven-plugin-api:jar:null
> > > > > > > >>>>
> > > > > > > >>>> from the specified remote repositories:
> > > > > > > >>>>  maven2.dev.java.net (http://download.java.net/maven/2),
> > > > > > > >>>>  central (http://repo1.maven.org/maven2),
> > > > > > > >>>>  prime-repo (http://repository.prime.com.tr),
> > > > > > > >>>>  snapshot.ocean.net.au (
> http://maven.ocean.net.au/snapshot
> > ),
> > > > > > > >>>>  external.ocean.net.au (
> http://maven.ocean.net.au/external
> > ),
> > > > > > > >>>>  release.ocean.net.au (http://maven.ocean.net.au/release
> ),
> > > > > > > >>>>  java.net2 (http://download.java.net/maven/2)
> > > > > > > >>>>
> > > > > > > >>>> Path to dependency:
> > > > > > > >>>>        1)
> > > > > > > >>>>
> > > > org.glassfish.maven.plugin:maven-glassfish-plugin:maven-plugin:2.1
> > > > > > > >>>>        2) au.net.ocean.maven.plugin:maven-plugin:jar:1.0
> > > > > > > >>>>
> > > > > > > >>>> When I look at
> > au.net.ocean.maven.plugin:maven-plugin:jar:1.0
> > > > > > pom.xml,
> > > > > > > it
> > > > > > > >>>> has
> > > > > > > >>>>
> > > > > > > >>>>        <dependency>
> > > > > > > >>>>            <groupId>org.apache.maven</groupId>
> > > > > > > >>>>            <artifactId>maven-plugin-api</artifactId>
> > > > > > > >>>>            <version>[2.0,)</version>
> > > > > > > >>>>            <scope>compile</scope>
> > > > > > > >>>>        </dependency>
> > > > > > > >>>>
> > > > > > > >>>> and central repository has matching versions. Why doesn't
> > > maven
> > > > > find
> > > > > > > >>>> it? Using maven 2.2.1
> > > > > > > >>>>
> > > > > > > >>>> Is this problem still alive
> > > > > > http://jira.codehaus.org/browse/MNG-2742?
> > > > > > > >>>> It seems to be since it's unresolved.
> > > > > > > >>>>
> > > > > > > >>>> But how could something this important remain unresolved
> for
> > > 3,5
> > > > > > > years....?
> > > > > > > >>>>
> > > > > > > >>>> PS. I have no idea why maven tries to retrieve the
> > dependency.
> > > > > It's
> > > > > > > >>>> part of a child dependency's "compile scope" dependencies.
> > No
> > > > one
> > > > > is
> > > > > > > >>>>
> > > > > > > >>>
> > > > > > > >>> compile scope = at compile time and at runtime
> > > > > > > >>> provided scope = at compile time but not at runtime
> (because
> > > > > somebody
> > > > > > > else
> > > > > > > >>> will provide it)
> > > > > > > >>> runtime scope = not at compile time, but at runtime
> > > > > > > >>>
> > > > > > > >>>
> > > > > > > >>>> trying to compile
> > > > au.net.ocean.maven.plugin:maven-plugin:jar:1.0.
> > > > > > > >>>>
> > > > > > > >>>> PS2. This build works when I try it locally. Hudson does
> > > > something
> > > > > > > >>>> extra ([HUDSON] Archiving....?) that wants the dependency.
> > > > > > > >>>>
> > > > > > > >>>>
> > > > > >
> > ---------------------------------------------------------------------
> > > > > > > >>>> To unsubscribe, e-mail:
> [email protected]
> > > > > > > >>>> For additional commands, e-mail:
> > [email protected]
> > > > > > > >>>>
> > > > > > > >>>>
> > > > > > > >>>
> > > > > > > >>
> > > > > > > >
> > > > > > >
> > > > > > >
> > > ---------------------------------------------------------------------
> > > > > > > To unsubscribe, e-mail: [email protected]
> > > > > > > For additional commands, e-mail: [email protected]
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>

Reply via email to