On Mon, 2008-03-24 at 11:32 -0700, buzzterrier wrote:
> Hello, 
> 
> We have several projects that share common dependencies. I wanted to create
> a parent pom that allowed them to inherit these dependencies, but from what
> I can tell all the projects would need to be sub-projects of the parent to
> inherit the parent pom (not what we want). Digging around in the archives I
> found a thread that (loosely) described installing a pom that contains all
> the common dependencies, and then adding a reference to that artifact in
> your pom, making sure to reference it as <type>pom</type>. This works when I
> install it to my local repository. However, when I try to deploy it to our
> Internal repository, only the project description gets uploaded, without the
> dependencies. 
> 
> for example, here is a snippet of what gets installed locally:
> 
> ...   
> <project xmlns="http://maven.apache.org/POM/4.0.0";
>       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
>  http://maven.apache.org/maven-v4_0_0.xsd";>
>       <modelVersion>4.0.0</modelVersion>
> <groupId>com.foo</groupId>
>       <artifactId>common-dependencies</artifactId>
>       <packaging>pom</packaging>
>       <version>1.0</version>
>       <dependencies>
>                <dependency>
>                   <groupId>log4j</groupId>
>                   <artifactId>log4j</artifactId>
>                   <version>1.2.12</version>
>               </dependency>
>               <dependency>
>                       <groupId>axis</groupId>
>                       <artifactId>axis</artifactId>
>                       <version>1.3</version>
>                       <scope>compile</scope>
>               </dependency>
> ...
> 
> and here is what gets deployed to the Internal repository:
> 
> <project>
>   <modelVersion>4.0.0</modelVersion>
>   <groupId>com.foo</groupId>
>   <artifactId>common-dependencies</artifactId>
>   <packaging>pom</packaging>
>   <version>1.0</version>
> </project>
> 
> I use the following command to deploy it to the Internal repos:
> mvn deploy:deploy-file -DgroupId=com.foo -DartifactId=common-dependencies
> -Dversion=1.0 -Dpackaging=pom -Dfile=c:/poms/common-dependencies.xml
> -Durl=http://ourinternalrepos:8080/archiva/repository/internal
> -DrepositoryId=internal  -Dgenerate-pom=true
> 
> How do I get the dependencies included with the pom on the Internal
> repository? I read the docs and it seems like the deploy:deploy-file target
> should be used to install to an Internal repos, while install:install-file
> is for local repos. 

There are two completely separate tasks here:

(1)
Define a custom pom (with your group id) that declares dependencies on a
bunch of other libs, and deploy this to your company's repo. After that,
any project can declare a *dependency* on this pom, and that will cause
it to depend transiently on the libs that pom depends on.

Note that this is not necessarily a good idea. I personally think this
is bad; it hides the real dependencies which will just cause problems in
other ways. For example, if a security bug is discovered in one of those
libs and you need to find out which of your products are actually
vulnerable, then fine-grained dependencies will tell you this; but if
each of your products has a dependency on a whole block of libs even
when it doesn't use them all, then this analysis is impossible.

However if you are determined to do this, then Maven does support it.

(2)
Copy a bunch of libs into your company's repo.

AFAIK, there is no single command that combines the two.

When the libs referenced by the pom are all available via the master
repositories, then (2) is usually not needed. You just allow maven to
fetch the dependencies from the master repositories (possibly via a
caching proxy, to reduce load on the master repository servers, and
improve performance for you). Only if your company has strict security
policies that ban maven from downloading from the master repositories
"on demand" is (2) needed.

Of course, if the libs that your "dependencies" pom are depending on are
not in the master repos (eg if they are developed by your company) then
you do need to upload them. There is nothing in Maven itself that helps
to automate this process. I *think* that some of the "repository
manager" programs around can help, but haven't used any myself.

Regards,
Simon


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to