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> <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>
source share