简体   繁体   English

为tomcat7:run重新编译Java

[英]Recompile java for tomcat7:run

Using tomcat7:run to run a web app, I've noticed that while the web contents are served directly from the file system, I'm unsure how to trigger a recompile of changes we make to java files. 使用tomcat7:run运行Web应用程序时,我注意到虽然Web内容是直接从文件系统提供的,但是我不确定如何触发对Java文件所做的更改的重新编译。

Closing the server and rebooting works, but is there an automatic way? 关闭服务器并重新启动即可,但是有自动方法吗?

I don't know exactly what is the parameter that is doing this work. 我不知道执行此工作的确切参数是什么。 This is my configuration: 这是我的配置:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.tomcat.maven</groupId>
            <artifactId>tomcat7-maven-plugin</artifactId>
            <version>2.1</version>
            <configuration>
                <path>${module.context.root}</path>
                <port>${module.listen.port}</port>
                <contextReloadable>true</contextReloadable>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>mysql</groupId>
                    <artifactId>mysql-connector-java</artifactId>
                    <version>5.1.6</version>
                </dependency>
            </dependencies>
        </plugin>
    </plugins>
</build>

An it reloads the webapp immediately after I change some class. 更改某些类后,它会立即重新加载webapp。 Be aware that such classes must be within the same module (ie the module with war packaging). 请注意,此类必须在同一模块(即带有war包装的模块)内。 The plugin is not able to detect any change that occurs outside (eg another dependent module / project) 该插件无法检测到外部发生的任何更改(例如,另一个从属模块/项目)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM