You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Steinar Bang <sb...@dod.no> on 2006/11/09 15:22:57 UTC

Pulling jars into local repository

I have a script now that picks a lot of OSGi bundles I've built myself
from my local maven repository, and drops them into a directory
together with the eclipse runtime (as proposed earlier on this list),
that is used as the target location for eclipse plug-in development.

Now I need to distributes some 3rdparty OSGi bundles, and we have a
maven repository in the LAN for speeding up 3rdparty bundles, so
dropping the bundles there seems like the simplest way to distribute
them. 

My question is: what can I put in the top level pom.xml of the project
that builds our own OSGi bundles, that will pull in these bundles from
the company's central repository into developer's local repository.

The natural thing would be to just put in a <dependency> there, but I
worry that it might affect the OSGi plugins built here somehow.  The
OSGi plugin project doesn't really need these bundles.  It's the
eclipse run-time that needs them.

Perhaps a scope of runtime will work...?
	http://docs.codehaus.org/display/MAVENUSER/Dependency+Scopes

Thanx!


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


Re: Pulling jars into local repository

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

>>>>> Steinar Bang <sb...@dod.no>:
> [snip!]
>> Do I need to add a <scope> to the <artifactItem>, I wonder?

> Nope.  That just resulted in an error message.

> I also tried changing the <phase> of the copy-dependencies <execution>
> element, and that didn't help either.  Neither with <scope> "compile",
> nor "provided".

"Change the <phase> from 'packaging' to 'install'", I meant to say.


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


Re: Pulling jars into local repository

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

[snip!]
> Do I need to add a <scope> to the <artifactItem>, I wonder?

Nope.  That just resulted in an error message.

I also tried changing the <phase> of the copy-dependencies <execution>
element, and that didn't help either.  Neither with <scope> "compile",
nor "provided".


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


Re: Pulling jars into local repository

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

>>>>> "Tom Huybrechts" <to...@gmail.com>:
>> On 11/10/06, Steinar Bang <sb...@dod.no> wrote:

>>> Now, I need to find out if I can make maven pull in the eclipse
>>> bundles neccessary for the runtime, as well.  This would avoid this
>>> as a copying step.

>> Declare them as runtime dependencies ?

> Yes, that is the obvious approach.  My problem is that I don't know
> exactly which eclipse bundles to depend on, and from where.

I've now tried changing the <scope> of the dependencies from "compile"
to "provided".  Maven still copied the offending jar files (an OSGi
framwork incompatible with the version delivered with the eclipse IDE)
were still copied to the eclipse PDE platform directory.

I also tried changing the <scope> to "test", and this did succeed in
making maven not copy the jar files to the eclipse PDE platform
directory, but the bundle compilation failed because of a missing OSGi
framework.

Here are the <dependency> elements from the bundles' top level
pom.xml: 

   <dependency>
      <groupId>org.eclipse</groupId>
      <artifactId>osgi</artifactId>
      <version>3.1.2</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.eclipse.osgi</groupId>
      <artifactId>services</artifactId>
      <version>3.1.2</version>
      <scope>compile</scope>
    </dependency>

Here are the copy-dependencies settings from the same file:

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>dependency-maven-plugin</artifactId>
        <executions>
         <execution>
          <id>copy-dependencies</id>
          <phase>package</phase>
          <goals>
           <goal>copy-dependencies</goal>
          </goals>
          <configuration>
           <outputDirectory>${user.home}/pde_target_platform/plugins</outputDirectory>
           <excludeTransitive>true</excludeTransitive>
          </configuration>
         </execution>
         <execution>
          <id>copy</id>
          <phase>package</phase>
          <goals>
           <goal>copy</goal>
          </goals>
          <configuration>
           <artifactItems>
              <artifactItem>
                <groupId>${project.groupId}</groupId>
                <artifactId>${project.artifactId}</artifactId>
                <version>${project.version}</version>
                <type>${project.packaging}</type>
              </artifactItem>
           </artifactItems>
           <outputDirectory>${user.home}/pde_target_platform/plugins</outputDirectory>
          </configuration>
         </execution>
        </executions>
      </plugin>

Do I need to add a <scope> to the <artifactItem>, I wonder?


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


Re: Pulling jars into local repository

Posted by Steinar Bang <sb...@dod.no>.
>>>>> "Tom Huybrechts" <to...@gmail.com>:

> On 11/10/06, Steinar Bang <sb...@dod.no> wrote:

>> Now, I need to find out if I can make maven pull in the eclipse
>> bundles neccessary for the runtime, as well.  This would avoid this
>> as a copying step.

> Declare them as runtime dependencies ?

Yes, that is the obvious approach.  My problem is that I don't know
exactly which eclipse bundles to depend on, and from where.

And perhaps I should be careful of doing this, and instead just copy
the runtime from my eclipse installation like I've been doing?

I've just spent some time debugging why I got an SWT compile time
error, and the reason was that my maven copy-dependencies pulled in an
earlier, and presumably incompatible, version of the OSGi framework,
than the one provided by eclipse itself.

So I need to figure out a how to stop it from doing that.

Also, my earlier fragment of copy-dependencies was incomplete.  That
one only copied in the files my bundles depended on, but it didn't
copy in my bundles.

To do that, I need this as well:
         <execution>
          <id>copy</id>
          <phase>package</phase>
          <goals>
           <goal>copy</goal>
          </goals>
          <configuration>
           <artifactItems>
              <artifactItem>
                <groupId>${project.groupId}</groupId>
                <artifactId>${project.artifactId}</artifactId>
                <version>${project.version}</version>
                <type>${project.packaging}</type>
              </artifactItem>
           </artifactItems>
           <outputDirectory>${user.home}/pde_target_platform/plugins</outputDirectory>
          </configuration>
         </execution>

This copies in some .pom files as well as the bundle JARs, but they
don't seem to do any harm.

But I have to stop it from copying the older OSGi framework.


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


Re: Pulling jars into local repository

Posted by Tom Huybrechts <to...@gmail.com>.
Declare them as runtime dependencies ?

On 11/10/06, Steinar Bang <sb...@dod.no> wrote:
> >>>>> Steinar Bang <sb...@dod.no>:
>
> [snip!]
> >> But I still got the same error message when doing "mvn install".
>
> > That's because "mvn dependency:copy-dependencies" pulled in the
> > dependency-maven-plugin from org.codehaus.mojo, and not the
> > maven-dependency-plugin from apache.
>
> > This FAQ entry says they are the same but the apache one is the
> > recommended one.
> >       http://maven.apache.org/plugins/maven-dependency-plugin/faq.html
>
> > However, since I can only find the mojo one, I'm currently going with
> > it, and see where it takes me.
>
> This worked, in that it made "mvn install" also install the bundles
> produced by our own project, plus the ones they depend on, into the
>         $HOME/pde_target_platform/plugins/
> directory, and setting the PDE target platform in eclipse to point to
> $HOME/pde_target_platform made eclipse pick them up.
>
> Here are the settings from the top level pom.xml file:
>   <build>
>     ...
>     <plugins>
>       ...
>       <plugin>
>         <groupId>org.codehaus.mojo</groupId>
>         <artifactId>dependency-maven-plugin</artifactId>
>         <executions>
>          <execution>
>           <id>copy-dependencies</id>
>           <phase>package</phase>
>           <goals>
>            <goal>copy-dependencies</goal>
>           </goals>
>           <configuration>
>            <outputDirectory>${user.home}/pde_target_platform/plugins</outputDirectory>
>           </configuration>
>          </execution>
>         </executions>
>       </plugin>
>
> Now, I need to find out if I can make maven pull in the eclipse
> bundles neccessary for the runtime, as well.  This would avoid this as
> a copying step.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

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


Re: Pulling jars into local repository

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

[snip!]
>> But I still got the same error message when doing "mvn install".

> That's because "mvn dependency:copy-dependencies" pulled in the
> dependency-maven-plugin from org.codehaus.mojo, and not the
> maven-dependency-plugin from apache.

> This FAQ entry says they are the same but the apache one is the
> recommended one.  
> 	http://maven.apache.org/plugins/maven-dependency-plugin/faq.html

> However, since I can only find the mojo one, I'm currently going with
> it, and see where it takes me.

This worked, in that it made "mvn install" also install the bundles
produced by our own project, plus the ones they depend on, into the
	$HOME/pde_target_platform/plugins/
directory, and setting the PDE target platform in eclipse to point to
$HOME/pde_target_platform made eclipse pick them up.

Here are the settings from the top level pom.xml file:
  <build>
    ...
    <plugins>
      ...
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>dependency-maven-plugin</artifactId>
        <executions>
         <execution>
          <id>copy-dependencies</id>
          <phase>package</phase>
          <goals>
           <goal>copy-dependencies</goal>
          </goals>
          <configuration>
           <outputDirectory>${user.home}/pde_target_platform/plugins</outputDirectory>
          </configuration>
         </execution>
        </executions>
      </plugin>

Now, I need to find out if I can make maven pull in the eclipse
bundles neccessary for the runtime, as well.  This would avoid this as
a copying step.


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


Re: Pulling jars into local repository

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

> I have trouble getting it to work.

> I tried using it by putting
>   <build>
>     ...
>     <plugins>
>       ...
>       <plugin>
>         <groupId>org.apache.maven.plugins</groupId>
>         <artifactId>maven-dependency-plugin</artifactId>
[snip!]
> into the top level pom.xml file.  That gave me the following error
> when using the "mvn install" target:
[snip!]
> [INFO] The plugin 'org.apache.maven.plugins:maven-dependency-plugin' does not exist or no valid version could be found

> Running with "-e" as recommended, doesn't give much more information.

> Just doing "mvn dependency:copy-dependencies" from the command line,
> copied the mojo into my local maven repo, and then proceeded to pull
> all osgi bundles created by the project, together with the ones they
> depend on, from my local M2 repo and into target/dependency/
> subdirectories of the bundle projects'.

> But I still got the same error message when doing "mvn install".

That's because "mvn dependency:copy-dependencies" pulled in the
dependency-maven-plugin from org.codehaus.mojo, and not the
maven-dependency-plugin from apache.

This FAQ entry says they are the same but the apache one is the
recommended one.  
	http://maven.apache.org/plugins/maven-dependency-plugin/faq.html

However, since I can only find the mojo one, I'm currently going with
it, and see where it takes me.


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


Re: Pulling jars into local repository

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

>>>>> "Tom Huybrechts" <to...@gmail.com>:
>> The maven dependency plugin is your friend:
>> http://maven.apache.org/plugins/maven-dependency-plugin/resolve-mojo.html

> Hm... interesting.  This URL was more clarifying for me:
> 	http://maven.apache.org/plugins/maven-dependency-plugin/

I have trouble getting it to work.

I tried using it by putting
  <build>
    ...
    <plugins>
      ...
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
         <execution>
          <id>copy-dependencies</id>
          <phase>package</phase>
          <goals>
           <goal>copy-dependencies</goal>
          </goals>
          <configuration>
          </configuration>
         </execution>
        </executions>
      </plugin>

into the top level pom.xml file.  That gave me the following error
when using the "mvn install" target:
[INFO]    task-segment: [install]
[INFO] ----------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] The plugin 'org.apache.maven.plugins:maven-dependency-plugin' does not exist or no valid version could be found

Running with "-e" as recommended, doesn't give much more information.

Just doing "mvn dependency:copy-dependencies" from the command line,
copied the mojo into my local maven repo, and then proceeded to pull
all osgi bundles created by the project, together with the ones they
depend on, from my local M2 repo and into target/dependency/
subdirectories of the bundle projects'.

But I still got the same error message when doing "mvn install".

I'm suspecting some spelling error, but haven't been able to spot it,
so far.


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


Re: Pulling jars into local repository

Posted by Steinar Bang <sb...@dod.no>.
>>>>> "Tom Huybrechts" <to...@gmail.com>:

> The maven dependency plugin is your friend:
> http://maven.apache.org/plugins/maven-dependency-plugin/resolve-mojo.html

Hm... interesting.  This URL was more clarifying for me:
	http://maven.apache.org/plugins/maven-dependency-plugin/

> You can also use a different goal of the same plugin to copy them
> directly to the target location.

The things I need to do, are:

 - Pull the eclipse runtime JARs into a directory that can be used as
   the target platform location for eclipse plugin development
   (actually into the "plugins" subdirectory of the directory in the
   preferences dialog, in case anyone are to try it)

 - Everytime I build our own OSGi plugins, copy the ones I use, and
   all of the ones they depend on, into the eclipse plugin target
   location, toghether with the eclipse runtime JARs

It looks like the dependency plugin can do the entire job for me (I
thought I saw something about the eclipse OSGi bundles being put into
the central maven repository somewhere...?), or at least the second
part, ie. keeping the eclipse version of the bundles fresh...?

Is this a correct assumption?

Thanx for the information!


- Steinar


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


Re: Pulling jars into local repository

Posted by Tom Huybrechts <to...@gmail.com>.
The maven dependency plugin is your friend:
http://maven.apache.org/plugins/maven-dependency-plugin/resolve-mojo.html

You can also use a different goal of the same plugin to copy them
directly to the target location.

Tom

On 11/9/06, Steinar Bang <sb...@dod.no> wrote:
> I have a script now that picks a lot of OSGi bundles I've built myself
> from my local maven repository, and drops them into a directory
> together with the eclipse runtime (as proposed earlier on this list),
> that is used as the target location for eclipse plug-in development.
>
> Now I need to distributes some 3rdparty OSGi bundles, and we have a
> maven repository in the LAN for speeding up 3rdparty bundles, so
> dropping the bundles there seems like the simplest way to distribute
> them.
>
> My question is: what can I put in the top level pom.xml of the project
> that builds our own OSGi bundles, that will pull in these bundles from
> the company's central repository into developer's local repository.
>
> The natural thing would be to just put in a <dependency> there, but I
> worry that it might affect the OSGi plugins built here somehow.  The
> OSGi plugin project doesn't really need these bundles.  It's the
> eclipse run-time that needs them.
>
> Perhaps a scope of runtime will work...?
>         http://docs.codehaus.org/display/MAVENUSER/Dependency+Scopes
>
> Thanx!
>
>
> ---------------------------------------------------------------------
> 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