You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by email11249845 <em...@kinglibrary.net> on 2007/12/17 19:29:12 UTC

Maven2 + Classpath

Hi

Is there any way tell maven2 to search libraries at Classpath first and then
in maven repository?

My admin say that most of library needed are installed at /usr/share/java
and he wants to load libraries from this place first...

Thanks
-- 
View this message in context: http://www.nabble.com/Maven2-%2B-Classpath-tp14373971s177p14373971.html
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: Maven2 + Classpath

Posted by Steinar Bang <sb...@dod.no>.
>>>>> Steinar Bang <sb...@dod.no>:

Here's my mistake:

>   <dependency>
>    <groupId>org.eclipse.osgi</groupId>
>    <artifactId>org.eclipse.osgi</artifactId>
>    <version>3.2.1-R32x_v20060919</version>
>    <scope>system</scope>
>    <systemPath>${basedir}/target/dependencies/someosgiapp/org.eclipse.osgi_3.2.1_R32x_v20060919.jar</systemPath>
>   </dependency>

The value of <systemPath> is wrong.  It should be:
    <systemPath>${basedir}/target/dependency/someosgiapp/org.eclipse.osgi_3.2.1_R32x_v20060919.jar</systemPath>

Ie. "target/dependency" (the default <outputDirectory> of
dependency:unpack), instead of "target/dependencies".

And you were also right about this:

>>>>> "Stuart McCulloch" <st...@jayway.net>:

>> also check which build phase you do the unpacking, as the dependency
>> will be checked during [resources:resources] - so you probably need
>> to bind the unpacking goal to the generate-resources phase...

I had the unpacking done in generate-test-resources.  And that worked on
an "mvn install" with the node already present (once I got the
<systemPath> right), but not when I did "mvn clean install".

Moving the unpacking to generate-resources made "mvn clean install"
work.

Thanx for your help, Stuart!


- Steinar


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


Re: Maven2 + Classpath

Posted by Steinar Bang <sb...@dod.no>.
>>>>> "Stuart McCulloch" <st...@jayway.net>:

> I did a quick test and using ${basedir} appeared to work for me

I'm stuck with maven 2.0.4.  Perhaps that's the cause of my problems?

> - note that the basedir is the directory with the pom, so if you
> unpack to "target/someosgiapp" then you need to use
> <systemPath>${basedir}/target/someosgiapp/...etc...</systemPath>

Sorry about that.  I was overeager in my anonymizing.

It's actually
   <systemPath>${basedir}/target/dependencies/someosgiapp/org.eclipse.osgi_3.2.1_R32x_v20060919.jar</systemPath>

In any case, this gives no error message:

  <dependency>
   <groupId>org.eclipse.osgi</groupId>
   <artifactId>org.eclipse.osgi</artifactId>
   <version>3.2.1-R32x_v20060919</version>
  </dependency>

while this:

  <dependency>
   <groupId>org.eclipse.osgi</groupId>
   <artifactId>org.eclipse.osgi</artifactId>
   <version>3.2.1-R32x_v20060919</version>
   <scope>system</scope>
   <systemPath>${basedir}/target/dependencies/someosgiapp/org.eclipse.osgi_3.2.1_R32x_v20060919.jar</systemPath>
  </dependency>

gives:

[WARNING] 
	Artifact org.eclipse.osgi:org.eclipse.osgi:jar:3.2.1-R32x_v20060919:system retains local scope 'system' overriding broader scope 'compile'
	given by a dependency. If this is not intended, modify or remove the local scope.

[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.

Missing:
----------
1) org.eclipse.osgi:org.eclipse.osgi:jar:3.2.1-R32x_v20060919

  Try downloading the file manually from the project website.

  Then, install it using the command: 
      mvn install:install-file -DgroupId=org.eclipse.osgi -DartifactId=org.eclipse.osgi \
          -Dversion=3.2.1-R32x_v20060919 -Dpackaging=jar -Dfile=/path/to/file

  Path to dependency: 
  	1) com.somecompany.someapp.proxy:com.somecompany.someapp.proxy:jar:0.1.0
  	2) org.eclipse.osgi:org.eclipse.osgi:jar:3.2.1-R32x_v20060919

----------
1 required artifact is missing.


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


Re: Maven2 + Classpath

Posted by Stuart McCulloch <st...@jayway.net>.
On 18/12/2007, Steinar Bang <sb...@dod.no> wrote:
>
> >>>>> "Stuart McCulloch" <st...@jayway.net>:
>
> > well, there are system scope dependencies that let you refer to
> > library artifacts in a fixed location like "/usr/share/lib/..." but
> > their use is discouraged, because it makes things less portable:
>
> >
> http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html
>
> I tried doing this:
>   <dependency>
>    <groupId>org.eclipse.osgi</groupId>
>    <artifactId>org.eclipse.osgi</artifactId>
>    <version>3.2.1-R32x_v20060919</version>
>    <scope>system</scope>
>
> <systemPath>${basedir}/someosgiapp/org.eclipse.osgi_3.2.1_R32x_v20060919.jar</systemPath>
>   </dependency>
>
> (I first tried basing <systemPath> to be based on
> ${project.build.directory}, since the OSGi app is downloaded and
> unpacked with dependency:unpack, but that didn't work, since systemPath
> needs to be absolute.  However ${basedir} seems to be absolute, so using
> it got me past that stage)


I did a quick test and using ${basedir} appeared to work for me - note that
the basedir
is the directory with the pom, so if you unpack to "target/someosgiapp" then
you need
to use <systemPath>${basedir}/target/someosgiapp/...etc...</systemPath>
>
>
also check which build phase you do the unpacking, as the dependency will be
checked
during [resources:resources] - so you probably need to bind the unpacking
goal to the
generate-resources phase...

But maven didn't like it:
> [INFO]
> ------------------------------------------------------------------------
> [ERROR] BUILD ERROR
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Failed to resolve artifact.
>
> Missing:
> ----------
> 1) org.eclipse.osgi:org.eclipse.osgi:jar:3.2.1-R32x_v20060919
>
>   Try downloading the file manually from the project website.
>
>   Then, install it using the command:
>       mvn install:install-file -DgroupId=org.eclipse.osgi -DartifactId=
> org.eclipse.osgi \
>           -Dversion=3.2.1-R32x_v20060919 -Dpackaging=jar
> -Dfile=/path/to/file
>
>   Path to dependency:
>         1) com.somecompany.someapp:com.somecompany.someapp:jar:0.1.0
>         2) org.eclipse.osgi:org.eclipse.osgi:jar:3.2.1-R32x_v20060919
>
> ----------
> 1 required artifact is missing.
>
> for artifact:
>   com.somecompany.someapp:com.somecompany.someapp:jar:0.1.0
>
> from the specified remote repositories:
> [snip!]
>
> There is a version of the OSGi runtime with the given
> groupId/artifactId/version already in my local maven repository.
>
> Here's its POM:
>
> <?xml version="1.0" encoding="UTF-8"?><project>
>   <modelVersion>4.0.0</modelVersion>
>   <groupId>org.eclipse.osgi</groupId>
>   <artifactId>org.eclipse.osgi</artifactId>
>   <version>3.2.1-R32x_v20060919</version>
>   <distributionManagement>
>     <status>deployed</status>
>   </distributionManagement>
> </project>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
Cheers, Stuart

Re: Maven2 + Classpath

Posted by Steinar Bang <sb...@dod.no>.
>>>>> "Stuart McCulloch" <st...@jayway.net>:

> well, there are system scope dependencies that let you refer to
> library artifacts in a fixed location like "/usr/share/lib/..." but
> their use is discouraged, because it makes things less portable:

> http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html

I tried doing this:
  <dependency>
   <groupId>org.eclipse.osgi</groupId>
   <artifactId>org.eclipse.osgi</artifactId>
   <version>3.2.1-R32x_v20060919</version>
   <scope>system</scope>
   <systemPath>${basedir}/someosgiapp/org.eclipse.osgi_3.2.1_R32x_v20060919.jar</systemPath>
  </dependency>

(I first tried basing <systemPath> to be based on
${project.build.directory}, since the OSGi app is downloaded and
unpacked with dependency:unpack, but that didn't work, since systemPath
needs to be absolute.  However ${basedir} seems to be absolute, so using
it got me past that stage)

But maven didn't like it:
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.

Missing:
----------
1) org.eclipse.osgi:org.eclipse.osgi:jar:3.2.1-R32x_v20060919

  Try downloading the file manually from the project website.

  Then, install it using the command: 
      mvn install:install-file -DgroupId=org.eclipse.osgi -DartifactId=org.eclipse.osgi \
          -Dversion=3.2.1-R32x_v20060919 -Dpackaging=jar -Dfile=/path/to/file

  Path to dependency: 
  	1) com.somecompany.someapp:com.somecompany.someapp:jar:0.1.0
  	2) org.eclipse.osgi:org.eclipse.osgi:jar:3.2.1-R32x_v20060919

----------
1 required artifact is missing.

for artifact: 
  com.somecompany.someapp:com.somecompany.someapp:jar:0.1.0

from the specified remote repositories:
 [snip!]

There is a version of the OSGi runtime with the given
groupId/artifactId/version already in my local maven repository.

Here's its POM:

<?xml version="1.0" encoding="UTF-8"?><project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.eclipse.osgi</groupId>
  <artifactId>org.eclipse.osgi</artifactId>
  <version>3.2.1-R32x_v20060919</version>
  <distributionManagement>
    <status>deployed</status>
  </distributionManagement>
</project>


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


Re: Maven2 + Classpath

Posted by Steinar Bang <sb...@dod.no>.
>>>>> "Stuart McCulloch" <st...@jayway.net>:

> FYI, you might be interested in:

>    http://wiki.ops4j.org/confluence/x/A4A6    Pax-Runner
>    http://wiki.ops4j.org/confluence/x/8Q        Pax-Construct

> which aim to make OSGi development and deployment a breeze with Maven

Thanx for the tip!  I'll check them out.


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


Re: Maven2 + Classpath

Posted by Stuart McCulloch <st...@jayway.net>.
On 18/12/2007, Steinar Bang <sb...@dod.no> wrote:
>
> >>>>> "Wayne Fay" <wa...@gmail.com>:
>
> > That's just not the way Maven works. What libraries in particular do
> > you need -- many should be available in the Maven repo already, so its
> > simply a matter of writing the proper pom.xml <dependency> entries.
>
> That's not always sufficient.


well, there are system scope dependencies that let you refer to
library artifacts in a fixed location like "/usr/share/lib/..." but their
use is discouraged, because it makes things less portable:

http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html

Eg. if you want to start an OSGi application based on equinox, then you
> have to use a jar for the OSGi runtime, that resides in a directory that
> have a ./configuration/config.ini file, and in the same directory as the
> OSGi bundles the config.ini tells the OSGi runtime to load and start.
>
> (...says the experience of someone who tried using the version of the
> very same file in the maven repo, and didn't understand why the app
> didn't start, last Friday...)


FYI, you might be interested in:

   http://wiki.ops4j.org/confluence/x/A4A6    Pax-Runner
   http://wiki.ops4j.org/confluence/x/8Q        Pax-Construct

which aim to make OSGi development and deployment a breeze with Maven

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

Re: Maven2 + Classpath

Posted by Steinar Bang <sb...@dod.no>.
>>>>> "Wayne Fay" <wa...@gmail.com>:

> That's just not the way Maven works. What libraries in particular do
> you need -- many should be available in the Maven repo already, so its
> simply a matter of writing the proper pom.xml <dependency> entries.

That's not always sufficient.

Eg. if you want to start an OSGi application based on equinox, then you
have to use a jar for the OSGi runtime, that resides in a directory that
have a ./configuration/config.ini file, and in the same directory as the
OSGi bundles the config.ini tells the OSGi runtime to load and start.

(...says the experience of someone who tried using the version of the
very same file in the maven repo, and didn't understand why the app
didn't start, last Friday...)


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


Re: Maven2 + Classpath

Posted by Wayne Fay <wa...@gmail.com>.
That's just not the way Maven works. What libraries in particular do
you need -- many should be available in the Maven repo already, so its
simply a matter of writing the proper pom.xml <dependency> entries.

Wayne

On 12/17/07, email11249845 <em...@kinglibrary.net> wrote:
>
> Hi
>
> Is there any way tell maven2 to search libraries at Classpath first and then
> in maven repository?
>
> My admin say that most of library needed are installed at /usr/share/java
> and he wants to load libraries from this place first...
>
> Thanks
> --
> View this message in context: http://www.nabble.com/Maven2-%2B-Classpath-tp14373971s177p14373971.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

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