For files like log4j and EasyConf, I don't want them buried in the jar
file as this makes it difficult to edit the files. I'd like them on
disk and for the jar file to include the directory on the classpath so
that the files can be located without worrying about file paths.
What I have been doing is described below, which works great when you
assembly the binary distribution and run that version. It's not so
great when you are trying to work inside an IDE as the files in
src/main/config aren't on the classpath (whether they should be is
another question, as these files are likely production ready and in
the IDE you probably want "test" versions), for testing I have been
included a copy of these files in src/test/resources.
I'm not happy with the duplication when the files will be identical.
I'm not happy manually changing the classpath as I'd like
eclipse:eclipse to do the right thing.
Has anyone else thought about this scenario and what do they do?
Cheers
Barrie
My files:
src/main/config
- log4j.properties
- <app>.properties (for EasyConf)
In my pom.xml:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
<Class-Path>config/</Class-Path>
</manifestEntries>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
</manifest>
</archive>
</configuration>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>assembly:package</id>
<phase>package</phase>
<goals>
<!--
Work around for http://jira.codehaus.org/browse/MASSEMBLY-97
-->
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/main/assembly/bin.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
src/main/assembly/bin.xml:
copies the files into the correct directory structure expected for running via
java -jar <app>.jar
e.g
<fileSets>
<fileSet>
<directory>src/main/config</directory>
<outputDirectory>config/</outputDirectory>
<includes>
<include>*</include>
</includes>
<excludes>
<exclude>CVS</exclude>
</excludes>
</fileSet>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]