You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Taras Lipatov <ta...@lipatov.com> on 2008/09/12 21:23:28 UTC

maven dependency plugin question

Can some one please shine some light on the following scenario..

I have parent pom and 2 modules.
Module A produces a jar file
Module B has Module A's jar as dependency, but it uses the dependency 
plugin to unpack it.

If I run mvn package from the parent. Module B's dependency plugin is 
always trying to take the jar from the repository, not from Module A's 
target
So my build fails with [INFO] Unable to find artifact.

I always have to run mvn install on Module A before using Module B. 
Quite tedious..
And I do have the jar listed in Module B as a dependency and then again 
in he plugin like so:

<dependency>
    <groupId>foo.bar</groupId>
    <artifactId>myjar</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <type>jar</type>
    <scope>compile</scope>
</dependency>

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-dependency-plugin</artifactId>
    <version>2.0</version>
    <executions>
        <execution>
            <id>getjar</id>
            <phase>generate-sources</phase>
            <goals>
                <goal>unpack</goal>
            </goals>
            <configuration>
                <artifactItems>
                    <artifactItem>
                            <groupId>foo.bar</groupId>
                            <artifactId>myjar</artifactId>
                            <type>jar</type>
                        <overWrite>true</overWrite>
                        <outputDirectory>
                            target/tmp
                        </outputDirectory>
                    </artifactItem>
                </artifactItems>
                <overWriteReleases>true</overWriteReleases>
                <overWriteSnapshots>true</overWriteSnapshots>
            </configuration>
        </execution>
    </executions>
</plugin>

Any thoughts?
Thanks!

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


Re: maven dependency plugin question

Posted by Brett Porter <br...@gmail.com>.
The dependency plugin in its current version doesn't query the reactor for
available projects, just the repository. If you are already building the
previous project, it shouldn't be too much hassle to also install it in the
local repository.
Cheers,
Brett

2008/9/13 Taras Lipatov <ta...@lipatov.com>

> Can some one please shine some light on the following scenario..
>
> I have parent pom and 2 modules.
> Module A produces a jar file
> Module B has Module A's jar as dependency, but it uses the dependency
> plugin to unpack it.
>
> If I run mvn package from the parent. Module B's dependency plugin is
> always trying to take the jar from the repository, not from Module A's
> target
> So my build fails with [INFO] Unable to find artifact.
>
> I always have to run mvn install on Module A before using Module B. Quite
> tedious..
> And I do have the jar listed in Module B as a dependency and then again in
> he plugin like so:
>
> <dependency>
>   <groupId>foo.bar</groupId>
>   <artifactId>myjar</artifactId>
>   <version>1.0.0-SNAPSHOT</version>
>   <type>jar</type>
>   <scope>compile</scope>
> </dependency>
>
> <plugin>
>   <groupId>org.apache.maven.plugins</groupId>
>   <artifactId>maven-dependency-plugin</artifactId>
>   <version>2.0</version>
>   <executions>
>       <execution>
>           <id>getjar</id>
>           <phase>generate-sources</phase>
>           <goals>
>               <goal>unpack</goal>
>           </goals>
>           <configuration>
>               <artifactItems>
>                   <artifactItem>
>                           <groupId>foo.bar</groupId>
>                           <artifactId>myjar</artifactId>
>                           <type>jar</type>
>                       <overWrite>true</overWrite>
>                       <outputDirectory>
>                           target/tmp
>                       </outputDirectory>
>                   </artifactItem>
>               </artifactItems>
>               <overWriteReleases>true</overWriteReleases>
>               <overWriteSnapshots>true</overWriteSnapshots>
>           </configuration>
>       </execution>
>   </executions>
> </plugin>
>
> Any thoughts?
> Thanks!
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
Brett Porter
Blog: http://blogs.exist.com/bporter/