I am using JBOSS AS7.1, Eclipse Luna for development. My eclipse installation does have a plugin installed for maven.
I have created my webapp project using maven command-line.
In my current set up, I have to build my maven project using mvn clean install
every time for all changes, even for the static files like HTML, CSS.
Then, I have to deploy the generated WAR file using JBOSS console running at http://localhost:9990/console
.
I am quite sure that there must be another way to do this. Surely, it does take a hell lot of time.
Please guide me to the approaches I can adopt for faster development.
2 Answers
Answers 1
One option is jrebel. It's not free though.
If you are not bound to JBOSS, you could use spring boot. It also supports automatic restart (spring boot devtools)
Answers 2
You can replace the static file in your target folder and launch a build skipping the compile
phase.
It will save you a lot of time, when only updating static files.
It is not a good practice, but should let you achieve your goal.
How to:
- Use the
maven-clean-plugin
to remove the files to replace from the target folder (or they will not be overwritten); - Use the
resources
tag if your static files are not the only content of the resources folder you want to copy (or your static files are not in resources folder at all); - Use the
maven-compiler-plugin
to skip the compile phase.
Customize 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>
0 comments:
Post a Comment