I have a large project that has some jar dependencies that are not in any of the public repositories. Licenses prevent their being put there. Rather than have my maven2 projects explicitly refer to these jar files in the file system, I'd like to create a file-based repository to include in my source distribution that is pre-populated with these third-party jar files. I'd then have the project's pom refer to this file-based repository, such that any dependencies would be looked up in this file-based repository. I think this is better than having to ship a shell script that invokes "mvn install:install-file" on each of the jar files to populate the user's local repository with these third-party dependencies.
It would appear from the documentation of maven-assembly-plugin that this plugin should be able to do the trick. But I haven't yet figured out how to do what I want. I'd like to have a project that will populate this file-based repository using a list of the project's dependencies. When the project is "assembled", it would use the mavan-assembly-plugin to store in a file-based repository all the artifacts that are listed in the project's dependencies (not transitive, only direct). For example, the project's pom would look (something) like: <project> xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <modelVersion>4.0.0</modelVersion> <groupId>com.sony.cdt</groupId> <artifactId>bootstrap-repository</artifactId> <packaging>pom</packaging> <version>1.0-SNAPSHOT</version> <name>Bootstrap Repository</name> <!-the following list of dependencies are the ones I want to store in the bootstrap repository. --> <dependencies> <dependency> <groupId>org.acme</groupId> <artifactId>foo</artifactId> <version>1.0</version> </dependency> </dependencies> <build> <plugins> <plugin> <artifactId>maven-assembly-plugin</artifactId> <version>2.0-beta-1</version> <configuration> <descriptor>src/main/assembly/assembly.xml</descriptor> <outputDirectory>target/output</outputDirectory> <workDirectory>target/assembly/work</workDirectory> </configuration> </plugin> </plugins> </build> </project> The assembly descriptor would look something like this: <assembly> <id>repository</id> <formats> <format>jar</format> </formats> <repositories> <repository> <includeMetadata>true</includeMetadata> <outputDirectory>maven2</outputDirectory> </repository> </repositories> </moduleSets> </assembly> Now what I want to be able to have is some element (moduleSets, dependencySets, fileSets) that says: include all this pom's dependencies. I don't want to list them explicitly. I want the list to be populated using the <dependencies> in the pom. Is this possible? Of course, I could do away with the dependencies list in the pom and just use: <moduleSets> <moduleSet> <includes> <include>org.acme:foo:1.0</include> </includes> </moduleSet> And I've tried that - but my "output repository jar" is always empty (except for the manifest). Here is an actual assembly descriptor that I've used, and the output jar is always empty: <assembly> <id>repository</id> <formats> <format>jar</format> </formats> <repositories> <repository> <includeMetadata>true</includeMetadata> <outputDirectory>maven2</outputDirectory> </repository> </repositories> <moduleSets> <moduleSet> <includes> <include>org.acme:foo:1.0</include> </includes> </moduleSet> </moduleSets> <dependencySets> <dependencySet> <includes> <include>org.acme:foo:1.0</include> </includes> </dependencySet> </dependencySets> </assembly> Can anyone tell me what I'm doing wrong? Does the <repositories> feature (in the assembly descriptor) actually work? -- Eric
