Maven app-assembler, assembly and classpath: config directory conflict

776 Views Asked by At

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,

0

There are 0 best solutions below