You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by motes motes <mo...@gmail.com> on 2011/09/30 16:21:05 UTC
Resources not included in build jar
I have created some sub folders in src/main/resources that I would
like to include in the final artifact.jar file.
<build>
<resources>
<resource>
<directory>src/main/resources/</directory>
</resource>
<resource>
<directory>src/main/resources/logs</directory>
</resource>
<resource>
<directory>src/main/resources/data</directory>
</resource>
</resources>
...
Next I copy these resources to the target folder:
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<outputDirectory>${target.basedir}</outputDirectory>
<includeEmptyDirs>true</includeEmptyDirs>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
</configuration>
<executions>
<execution>
<id>copy-resources</id>
<phase>packaging</phase>
<goals>
<goal>copy-resources</goal>
</goals>
</execution>
</executions>
</plugin>
Further I use the maven-dependency-plugin during compile time to fetch
some dependencies from nexus and copy those the /target folder.
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-and-unpack</id>
<phase>generate-sources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.test</groupId>
<artifactId>assembly</artifactId>
<version>1.0.1</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${target.basedir}</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
These dependencies should also be included in the final artifact.jar
file. But after I have run mvn clean install the artifact.jar file
only contains the manifest file.
How do I include resources from the project and target folder i the
final artifact.jar file?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Resources not included in build jar
Posted by Bram Patelski <br...@gmail.com>.
Hi,
Are these empty folders? If not: They should be included in the jar
automatically.
You could also have a look at this page:
http://maven.apache.org/plugins/maven-resources-plugin/examples/include-exclude.html
Regards,
Bram
On Fri, Sep 30, 2011 at 16:21, motes motes <mo...@gmail.com> wrote:
> I have created some sub folders in src/main/resources that I would
> like to include in the final artifact.jar file.
>
> <build>
> <resources>
> <resource>
> <directory>src/main/resources/</directory>
> </resource>
> <resource>
>
> <directory>src/main/resources/logs</directory>
> </resource>
> <resource>
>
> <directory>src/main/resources/data</directory>
> </resource>
> </resources>
> ...
>
> Next I copy these resources to the target folder:
>
> <plugin>
>
> <artifactId>maven-resources-plugin</artifactId>
> <configuration>
>
> <outputDirectory>${target.basedir}</outputDirectory>
>
> <includeEmptyDirs>true</includeEmptyDirs>
> <resources>
> <resource>
>
> <directory>src/main/resources</directory>
> </resource>
> </resources>
> </configuration>
> <executions>
> <execution>
> <id>copy-resources</id>
> <phase>packaging</phase>
> <goals>
>
> <goal>copy-resources</goal>
> </goals>
> </execution>
> </executions>
> </plugin>
>
>
>
> Further I use the maven-dependency-plugin during compile time to fetch
> some dependencies from nexus and copy those the /target folder.
>
> <plugin>
>
> <artifactId>maven-dependency-plugin</artifactId>
> <executions>
> <execution>
> <id>copy-and-unpack</id>
>
> <phase>generate-sources</phase>
> <goals>
> <goal>unpack</goal>
> </goals>
> <configuration>
> <artifactItems>
>
> <artifactItem>
>
> <groupId>com.test</groupId>
>
> <artifactId>assembly</artifactId>
>
> <version>1.0.1</version>
>
> <type>zip</type>
>
> <overWrite>true</overWrite>
>
> <outputDirectory>${target.basedir}</outputDirectory>
>
> </artifactItem>
> </artifactItems>
> </configuration>
> </execution>
> </executions>
> </plugin>
>
> These dependencies should also be included in the final artifact.jar
> file. But after I have run mvn clean install the artifact.jar file
> only contains the manifest file.
>
> How do I include resources from the project and target folder i the
> final artifact.jar file?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>