Gentoo Archives: gentoo-java

From: "Jörg Schaible" <joerg.schaible@×××.de>
To: gentoo-java@l.g.o
Subject: [gentoo-java] Re: [mvn-intg] maven-from-source : An issue when invoking mvn
Date: Wed, 29 Jun 2011 21:17:12
Message-Id: iug4mi$avh$
In Reply to: [gentoo-java] [mvn-intg] maven-from-source : An issue when invoking mvn by Kasun Gajasinghe
Hi Kasun,

Kasun Gajasinghe wrote:

> Hi, > After bumping more than 50 ebuilds, we were finally able to bump maven > package itself. But there's few issues to get over with. > > Following error occurs when mvn-2.2 is invoked. As you probably > already know, maven uses classworlds-1.1 for class loading. Further, > upstream uses uberjar, which packages all the dependencies together. > We have circumvented the need for having an uberjar by creating > symlinks of needed jars under the directory /usr/share/maven-2.2/lib/. > > As I see, it fails before getting in to maven through classworlds. > Unfortunately, I haven't have much experience with of classworlds > behaves. Does anyone of you have any idea to get rid of this error? > This _may_ not be an issue of maven having an incorrect classpath. > > If this is through, we'll be much closer to getting maven from source > working. > > $ mvn-2.2 -X > + Error stacktraces are turned on. > Apache Maven 2.2.1 (r1135082; 2011-06-26 09:41:29+0530) > Java version: 1.6.0_25 > Java home: /opt/sun-jdk- > Default locale: en_US, platform encoding: ANSI_X3.4-1968 > OS name: "linux" version: "2.6.36-gentoo-r8" arch: "i386" Family: "unix" > org.codehaus.classworlds.NoSuchRealmException: plexus.core > at org.codehaus.classworlds.ClassWorld.getRealm( > at org.codehaus.classworlds.Launcher.mainWithExitCode( > at org.codehaus.classworlds.Launcher.main(
Did you try this without symlinks, just for test?
> Maven is called via classworlds with the command: > "${JAVACMD}" \ > $MAVEN_OPTS \ > -classpath $(java-config -p classworlds-1.1) \ > -Dclassworlds.conf=/usr/share/maven-2/maven_home/bin/m2.conf \ #the m2. > -Dmaven.home=/usr/share/maven-2.2 \ > -Dmaven.repo.remote=${HOME}/.m2/repository \ > -Dmaven.repo.local=${HOME}/.m2/repository \ > ${CLASSWORLDS_LAUNCHER} \ > ${@} > > (The full script: >
java/maven/files/2.2.1/bin/mvn) Explain __MAVENHOME__ and __MAVEN_SHARE__. I am also wondering about:
> -Dmaven.repo.remote=${HOME}/.m2/repository \ > -Dmaven.repo.local=${HOME}/.m2/repository \
Note, that the format of the meta data in a remote and a local repo *differs*. AFAICS you cannot have both at the same location. Why not have one single system-wide remote repo, that is "stuffed" with the Gentoo- installed libraries only? Simply add that to /usr/share/maven-2.2/conf/settings.xml in an always active profile named e.g. "gentoo-system".
> > And, m2.conf file looks like this: > ======= > main is org.apache.maven.cli.compat.CompatibleMain from plexus.core > > set maven.home default ${user.home}/m2 > > [plexus.core] > load ${maven.home}/lib/*.jar > ======== > > Let me know if any more information is needed
Maybe it's simply stupid? $ file /usr/share/maven-bin-2.2/bin/m2.conf /usr/share/maven-bin-2.2/bin/m2.conf: ASCII text, with CRLF line terminators - Jörg