我正在使用JBOSS AS7.1,Eclipse Luna进行开发。我的eclipse安装确实为maven安装了一个插件。
我使用maven命令行创建了我的webapp项目。
在我目前的设置中,我必须每次都使用mvn clean install
构建我的maven项目以进行所有更改,即使对于HTML,CSS等静态文件也是如此。
然后,我必须使用在http://localhost:9990/console
运行的JBOSS控制台部署生成的WAR文件。
我很确定必须有另一种方法来做到这一点。当然,这需要花费很多时间。
请引导我采用我可以采用的方法来加快开发速度。
答案 0 :(得分:3)
您可以替换目标文件夹中的静态文件,并启动跳过compile
阶段的构建。
只更新静态文件时,它会为您节省大量时间。
这不是一个好习惯,但应该让你实现目标。
如何:
maven-clean-plugin
从目标文件夹中删除要替换的文件(或者不会覆盖它们); resources
标记; < / LI>
maven-compiler-plugin
跳过编译阶段。自定义此配置文件(并将其与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>
答案 1 :(得分:2)
一个选项是spring boot devtools。但它并不是免费的。
如果您没有绑定JBOSS,可以使用spring boot。它还支持自动重启(Counter
)