Question

I have a module , while building this module i want to include some resources from an external jar into my module jar.

I tried to use maven-shade-plugin but I am not able to achieve it it.

Any help is appreciated.

Était-ce utile?

La solution

Unpack your external resource into project target, after this unpacked resources will be included in generated artifact.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-dependency-plugin</artifactId>
    <executions>
        <execution>
            <id>unpack</id>
            <phase>process-resources</phase>
            <goals>
                <goal>unpack</goal>
            </goals>
            <configuration>
                <artifactItems>
                    <artifactItem>
                        <groupId>foo</groupId>
                        <artifactId>bar</artifactId>
                        <version>1.0</version>
                        <type>jar</type>
                        <includes>*.xsb, *.properties</includes>
                    </artifactItem>
                </artifactItems>
                <outputDirectory>${project.build.outputDirectory}</outputDirectory>
                <overWriteReleases>true</overWriteReleases>
                <overWriteSnapshots>true</overWriteSnapshots>
            </configuration>
        </execution>
    </executions>
</plugin>

For non-maven file use method from this answer https://stackoverflow.com/a/3264160/516167

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top