Resources file configurable in multi module maven project - java

I have one parent project which has WAR and JAR project. Currently the .xml and .properties files are packaged with jar. My requirement is that I want the resources folder of jar project which as .xml and .properties files to be available in WEB-INF folder of the war when the war project is build.
So that I can edit the files when the war is deployed on server.

There are a few ways to share resources across multiple projects or modules:
Cut and paste them.
Use Assembly and Dependency plugins
Use the maven-remote-resources-plugin
the second approach is described here
the third approach is described here

Related

Ant War Task: how to specify several folders with class files and libs

I have a Java webservice project. I want to build the War file using Ant War Task. As the project depends on sub projects (non web projects) there are several folders with class files and libs that have to been put in the War.
Is it possible to make the Ant War Task search more than one folder for class files? Same for libs.
Or do I have to copy all the class files in one folder first and give that folder to the Ant War Task?

Prevent intermediate Maven artifacts from being uploaded

I have a project creating some FAT jar to be used via webstart loaded from an ear. This leads to the following Maven projects in a multi-module project
jar project creating the FAT jar
war project creating the webstart war
ear file containing the server application and the war file for webstart
The jar and war artifacts are only used as intermediate artifacts to be able to create the ear artifact. However, Maven handles them as artifacts and so they are always uploaded to Nexus.
Since the jar is getting real fat, I would like to avoid uploading it 3 times to nexus for each build. Is there a way to avoid this? I can think of two ways:
Moving that three projects to one pom file
Some flag / option / whatever telling Maven to handle artifacts as intermediate artifacts not being deployed or installed
Does something like this or any other solution to my problem exist?
If this is a multi-module project, you can set <maven.deploy.skip> to true in the projects where artifacts should not be deployed.

JBoss: Load jars in lib's subfolders

Is there a way to make JBoss load .jar files that are placed within sub-folders of a specific lib folder?
We unfortunately can't use a dependency management tool such as Maven in our environment and packaging jars into folders would help for manual management.

Maven war plugin - including other files in WAR

I am building an Maven based Java web-app. In my src/main/java/package folder I have a .xml file and a .properties file that needs to be included as a part of my war. However when I look at the war file that gets generated (using a maven install) this does not include the .xml and the .properties file. It only contains the .class files from the package.
Is there anyway of including these files in the war ?
In addition, I also checked under the target/classes folder, here again the .xml and .properties files are not included.
Put your .xml file and .properties file in resources folder of your project, by default Maven will pick it up from there.
Little more googling around stackoverflow got me the answer. I just had to change the default resources folder for maven as outline in the following stackoverflow question Why does maven not copy the properties files during the build process?.

Converting backends to modules. I.e. going from WAR to EAR structure

We are in the process of converting our appengine project that uses backends to one that uses modules instead. See https://developers.google.com/appengine/docs/java/modules/converting
This implies going from a WAR project to an EAR project.
However the appengine eclipse plugins only has support for pointing out a WAR directory.
Does anybody know how this work. I.e. should we point this to our EAR directory?
We faced the same problem when migrating from backend to modules.
it seems that currently the GPE doesn't support modules, how ever we did solve this with this hack:
We renamed our WAR directory to "default" (you can point the web application there (under Project Properties -> Google -> Web Application -> WAR Directory).
We also included a dispatch.xml file in that module's WEB-INF dir that tells appengine which module to serve according to urls.
the last thing we had to do is to have a custom script that compiles gwt/class to those directories and deploys to appengine.
here is the overview of the project's layout change:
OLD LAYOUT
project_main_dir
war
NEW LAYOUT
project_main_dir
default
WEB-INF
dispatch.xml
module1
WEB-INF
module2
WEB-INF

Categories