3

I am using app-assembler Maven plug-in to create an installation of my Java application. I want some of the data (properties and some user-produced data) to be available in the filesystem rather than in any Jar file.

app-assembler allows me to do just that by adding a config directory to classpath.

The contents of that same config directory are needed to run some of my tests. Therefore, I declare that directory a resource in my Maven configuration.

Here is where the disconnect happens: if I set the targetPath of my config directory resource to "config", it's very easy for assembly (not app-assembler) plug-in to pick it up for packaging, but the classpath URL will be different between deployed application and Eclipse: the deployed app will think the URL is classpath:/default.properties, while inside Eclipse the URL is classpath:/config/default.properties. If I make the targetPath to be empty (installed directly under classes, the classpath URLs match between Eclipse and deployed environment, but there is no nice way to pick out the config data in teh assembly plugin configuration.

At the moment I am going with the second option, and place into config directory everything from classes that is not a class.

A better solution may be to create another classpath directory in Maven, similar to classes and test-classes, but I am not sure how to do that.

So I have two questions:

  • am I missing something obvious in resource, assembly and app-assembler plugins?
  • or if I am not, then how can I add config directory to classpath in Maven/Eclipse environment the same way it's added by app-assembler scripts in deployed environment?

Versions used: Maven3, app-assembler 1.2.2,

  • Which version of appassembler-maven-plugin do you use? Have you taken a look into the generated script (appassembler-maven-plugin)? Can you post the pom? – khmarbaise Aug 24 '12 at 17:58
  • Answered in the edit to question about versions. I'd rather not post the pom. And the scripts do exactly what they are supposed to do: form a classpath consisting of all Jars and config directory. I could use env vars to add to that classpath. –  Aug 24 '12 at 18:31

0 Answers0