Do I have to create a maven webapp project every time I make changes to static files?

I am using JBOSS AS7.1, Eclipse Luna for development. My eclipse installation has a maven plugin installed.

I created my webapp project using the maven command line.

In my current setup, I have to create my maven project every time using mvn clean install for all changes even for static files such as HTML, CSS.

Then I need to deploy the generated WAR file using the JBOSS console running at http://localhost:9990/console .

I am pretty sure there must be another way to do this. Surely this takes a lot of time.

Please lead me to approaches that I can take for faster development.

+5
source share
2 answers

One jrebel parameter. It is not free though.

If you are not tied to JBOSS, you can use spring boot. It also supports auto restart ( spring boot devtools )

+2
source

You can replace the static file in the target folder and start the assembly by skipping the compile phase.

This will save you a lot of time when only updating static files.

This is not a good practice, but you must achieve your goal.

How to :

  • Use maven-clean-plugin to delete files for replacement from the target folder (or they will not be overwritten);
  • Use the resources tag if your static files are not the only contents of the resource folder that you want to copy (or your static files are not in the resource folder at all);
  • Use the maven-compiler-plugin to skip the compilation phase.

Configure this profile (and use it with mvn clean install -P skip-compile ):

 <profile> <id>skip-compile</id> <build> <resources> <!-- optional --> <resource> <directory>src/main/resources/META-INF</directory> <targetPath>META-INF</targetPath> <excludes> <exclude>**/*.xml</exclude> </excludes> <includes> <include>**/*.html</include> <include>**/*.css</include> </includes> </resource> </resources> <plugins> <plugin> <artifactId>maven-clean-plugin</artifactId> <version>3.0.0</version> <configuration> <excludeDefaultDirectories>true</excludeDefaultDirectories> <filesets> <fileset> <directory>${project.build.outputDirectory}/META-INF</directory> <excludes> <exclude>**/not_to_delete.xml</exclude> </excludes> <includes> <include>**/*.html</include> <include>**/*.css</include> </includes> <followSymlinks>false</followSymlinks> </fileset> </filesets> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <executions> <execution> <id>default-compile</id> <phase>compile</phase> <goals> <goal>compile</goal> </goals> <configuration> <skipMain>true</skipMain> </configuration> </execution> </executions> </plugin> </plugins> </build> </profile> 
+2
source

All Articles