I have been trying to find a way to get Maven to produce a jar artifact
that includes (some of) its dependent artifacts, without much luck. I
have seen a few ways that promise this, but none panned out in the ways
that we need. If anyone can suggest a way to do this, I'd be much
obliged. I included my POM and assembly files below.
 
I did get this to work somewhat using assembly descriptors, but I also
need the manifest to have certain project-specific values which get
inserted using the standard jar plugin under <manifestEntries>. They
don't get inserted into the *-jar-with-dependencies that the assembly
plugin produces.
 
There's also talk about the Classworld's Uberjar plugin, but I cannot
figure out how to invoke it. The artifact id is not found to download,
and I don't know to configure it, despite all the documentation on it.
It might be specific to Maven 1.x, I am using Maven 2.0.2.
 
Thanks to all in advance,
 
-Dov Wasserman
 
________________________________

 
Project POM:
 
<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>
    <parent>
        <groupId>big-project</groupId>
        <artifactId>client-components</artifactId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <groupId>big-project-component</groupId>
    <artifactId>component-search</artifactId>
    <packaging>jar</packaging>
    <name>My Special Web Component</name>
    <url>http://maven.apache.org</url>
    <version>1.0-SNAPSHOT</version>
    <dependencies>
        <dependency>
            <groupId>...</groupId>
            <artifactId>...</artifactId>
            <version>1.0-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
 
     <!-- this is the jar I want included in this project's jar file -->
        <dependency>
            <groupId>big-project</groupId>
            <artifactId>local-model</artifactId>
            <version>1.0-SNAPSHOT</version>
            <scope>compile</scope>
        </dependency>
 
        <dependency>
            <groupId>sun</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.4</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <configuration>
                        <archive>
                            <manifestEntries>
                                <My-Component-Class>
 
com.foo.client.component.SearchComponent
                                </Component-Class>
                                <Component-Id>CS</Component-Id>
                                <.../>
                            </manifestEntries>
                        </archive>
                    </configuration>
                </plugin>
                <plugin>
                    <artifactId>maven-assembly-plugin</artifactId>
                    <configuration>
                        <descriptor>
                            src/main/assembly/dep.xml
                        </descriptor>
                        <archive>
                            <manifestEntries>
                            <!-- anything entries here are ignored -->
                            </manifestEntries>
                        </archive>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
</project>
 
________________________________


Assembly descriptor:
 
<assembly>
    <id>jar-with-dependencies</id>
    <formats>
        <format>jar</format>
    </formats>
    <includeBaseDirectory>false</includeBaseDirectory>
    <fileSets>
        <fileSet>
            <directory>target/classes</directory>
            <outputDirectory>/</outputDirectory>
        </fileSet>
    </fileSets>
    <dependencySets>
        <dependencySet>
            <outputDirectory>/lib/</outputDirectory>
            <unpack>false</unpack>
            <scope>runtime</scope>
        </dependencySet>
    </dependencySets>
</assembly>

________________________________

Reply via email to