Fix output directory for filter resources
#7
Merged
luca.frosini
merged 3 commits from fix-filtered-gcube-resource
into master
4 years ago
Loading…
Reference in New Issue
There is no content yet.
Delete Branch 'fix-filtered-gcube-resource'
Deleting a branch is permanent. It CANNOT be undone. Continue?
outputDirectory of filtered resources (i.e. resources presents in gcube/extra-resources/WEB-INF and gcube/extra-resources/META-INF diretory) has been fixed.
The prexix has been changed from
{project.build.outputDirectory} to
{project.build.directory}/${project.build.finalName}WIP: Fixed output directory of filter resourcesto Fix output directory for filter resources 4 years agoI did the following test.
I have this resource file (to be filtered, but it's not important here) in my project:
Using the maven-parent from the master branch, if I package the lib and inspect my jar, I can see data.txt in the expected location:
If I use the code in this PR, data.txt is NOT in the META-INF dir inside the output jar:
@luca.frosini can you please do a similar test with gcat and post here the content of the output war as I did above?
I'm speculating some differences between WARs and JARs that we didn't properly take into account.
I added the following file gcube/extra-resources/META-INF/test.xml
The tree of the project is this:
The tree of the extracted war created with maven-parent in master branch is this:
Please note that
The tree of the extracted war created with maven-parent of this pull request is:
Please note that
I'm using the branch feature/19735 of gcat
I'm going to test a library (i.e. gcat-api) in place of a service so that we can understand if there are differences
Here is the gcat-api project tree (branch feature/19735):
The tree of the extracted jar created with maven-parent in master branch is:
All the files are in the right location
The tree of the extracted jar created with maven-parent of this pull request is:
There are no gcube-app.xml and test.xml files.
@manuele.simi you are right, there are different behaviour between jar and war.
@luca.frosini Can you pull again the branch (I pushed a commit few secs ago) and test it against the gcat api and service? Thanks!
The tree of the extracted jar for gcat-api seems fine
The tree of the extracted war for gcat is
For services META-INF and WEB-INF are still inserted inside WEB-INF/classes
I was looking if it is possibile to define the output directory depending on the packaging of the artifact (i.e. war or jar) but I didn't find a way.
I'm wondering if it is possibile to accomplish such a task in maven-war-plugin and maven-jar-plugin instead of in maven-resources-plugin.
Here is the link I was reading
https://maven.apache.org/plugins/maven-war-plugin/examples/adding-filtering-webresources.html
https://maven.apache.org/plugins/maven-jar-plugin/jar-mojo.html
I tried with the maven-war-plugin's webresources. Unfortunately, it requires the extra-resources folder mandatory, which is not what we want.
Looking for some alternatives...
gcube-app.xml is mandatory for any gcube service. I think we can use it
Otherwise we can create a service maven parent.
e.g. gcube-service-parent
I pushed a new commit with a further fix. Output paths are now set with conditional properties. The condition is on the project's packaging.
My tests seem OK.
With a lib:
With a service:
I checked the pom and the solution sound good. Thanks a lot.
I confirm that the solution works properly both with a the service as well as with a library.
The tree of the extracted jar for gcat-api is
The tree of the extracted war for gcat is
Thanks a lot.
7950525cfc
.