I've been developing a standard web app and its really annoying to have Eclipse show src/main/resources and src/main/java in such a convenient flat-package way, yet I have to frequently drill down into src/main/webapp and all its subdirectories to modify my css, js, and html files.
I've never seen a project use additional source folders for resources like those, but is it out of the question to try? Ideally I'd love to have a directory structure like
src/main/java
src/main/resources
src/main/jsp
src/main/javascript
src/main/css
Has anyone setup a project like this? Does it become more of a hassle to even try, breaking existing plugins and whatnot?
Add resource folders this way.
<project>
...
<build>
...
<resources>
<resource>
<directory>resource1</directory>
</resource>
<resource>
<directory>resource2</directory>
</resource>
<resource>
<directory>resource3</directory>
</resource>
</resources>
...
</build>
...
</project>
More information
However, if you want multiple web resources (WEB-INF
directory in WAR file) than you need to configure Maven War plugin.
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<webResources>
<resource>
<directory>src/main/jsp</directory>
</resource>
<resource>
<directory>src/main/javascript</directory>
</resource>
<resource>
<directory>src/main/css</directory>
</resource>
</webResources>
</configuration>
</plugin>
</plugins>
</build>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With