1

I am working on an existing project. It is a web application with a backend written in Java and a number of static images, HTML and Javascript resources packaged as a WAR file.

The project is fairly old and has a completely custom structure in terms of:

  • directory structure,
  • dependency management (a bunch of jars in a directory, no explicit dependency on a specific build like with Maven),
  • build tasks (compilation and creation of WAR file, with a custom Ant script setting up the classpath, copying some files and not others when building the WAR file, etc...).

I want to modernize this structure and migrate the project to Gradle. I would like to stick to the default directory structure and build tasks as much as possible.

Part of this means creating src/main/webapp, and moving all static resources under that directory. The default build tasks will package everything under src/main/webapp to the root of the WAR file.

The problem is that with the Javascript code being non-trivial, there are a number of Javascript files that are relevant only at dev or testing time, such as definition of unit tests and un-minified versions of 3rd party libraries.

If I place these files in src/main/webapp, they would get included in the WAR file and deployed to production, unless I customized the build tasks to exclude them (the gradle war task specifically).

If I place them in a different directory I would have a custom directory structure, and I probably would have to customize my environment to be able to refer to them conveniently during development.

How do people typically deal with this type of setup?

4

0 回答 0