Issue
I have a custom properties folder for each build environment. I have defined profiles for it and added the different folder. They get picked up properly. However the resources in src/main/resources is not being picked up. I am using netbeans 8 if it makes a difference. My question is once a different profile is activated, should the main resources or test resources need be specified again in the profile? Thanks.
I am developing a java web project using maven. There are some xml files (handlerchain.xml) for some web services that need to be redeployed. These files reside in the same source directory as the java files which do not get copied. Hence I put these files into src/main/resources directory so that they will be deployed properly when it is time to build/test...
I also have a custom resources directory where I hold a set of properties files for each build case. They are all named the same but reside in different directories such as dev, prod, etc.. To deploy these into the build, I am using profiles and hence I have one profile set up for dev, prod, etc. In these profiles, I have added the custom resources directory with the proper directory such as custom-resources/dev for dev profile and custom-resources/prod for production profile.
I have noticed that the src/main/resources do not get deployed when I am using dev profile. It only gets deployed when I specifically add it as a resource in the profile/build/resources path. Is this because since I am using a custom profile and did override resources, I have to specify it?
In other words, I did not have to tell Maven where my java files are so why do I have to specify the directory for src/main/resources? Thanks.
Solution
Once you declare an explicit resource in the pom.xml Maven forgets that src/main/resources ever existed. You must now put it back explicitly:
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*</include>
</includes>
</resource>
Answered By - Ken Fogel
Answer Checked By - Marie Seifert (JavaFixing Admin)