maven jetty web项目自动热部署不成功,请救帮助!

发布于 2021-11-14 11:28:37 字数 1421 浏览 406 评论 3

maven + jetty测试WEB项目。但是发现JAVA类不会自动编译。粘出pom.xml代码,请求帮助。或者那位大神配置成功,把jetty插件的配置粘出来也行。谢谢.

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>basic</groupId>
  <artifactId>mywep</artifactId>
  <packaging>war</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>mywep Maven Webapp</name>
  <url>http://maven.apache.org</url>
  
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  
  <build>
    <finalName>mywep</finalName>
	<plugins>
		<plugin>
			<groupId>org.mortbay.jetty</groupId>
			<artifactId>maven-jetty-plugin</artifactId>
			<version>6.1.10</version>
			<configuration>
					<scanIntervalSeconds>2</scanIntervalSeconds>
			</configuration>
		</plugin>
	</plugins>
  </build>
</project>


如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

柳絮泡泡 2021-11-18 11:03:56

我是按照官网上配置的

<plugin>

<groupId>org.mortbay.jetty</groupId>

<artifactId>maven-jetty-plugin</artifactId>

<version>6.1.10</version>

<configuration>

<scanIntervalSeconds>10</scanIntervalSeconds>

<webAppConfig>

<contextPath>/app</contextPath>

<defaultsDescriptor>src/main/resources/webdefault.xml</defaultsDescriptor>

</webAppConfig>

<connectors>

<connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">

<!-- 端口号 -->

<port>8787</port>

<maxIdleTime>500000</maxIdleTime>

</connector>

</connectors>

</configuration>

</plugin>

<defaultsDescriptor>src/main/resources/webdefault.xml</defaultsDescriptor>

这个需要修改jar文件,将true改为false,不然你对html、js、css进行修改时需要重启启动jetty,具体百度

反话 2021-11-16 07:45:20

回楼上:我没有用到IDE。我看到你的代码:

<pluginManagement>
  		<plugins>
  			<plugin>
  			<groupId>org.mortbay.jetty</groupId>
  			<artifactId>maven-jetty-plugin</artifactId>
  			<version>6.1.26</version>
  			</plugin>
  		</plugins>
  	</pluginManagement>
并没有对自动扫描热布署配置,请问你的可以自动布署吗?
说明一下:我用的是maven3

居里长安 2021-11-15 11:01:34

点项目 右键,maven ->maven build没啊?

这是我的配置 文件 :    

<project xmlns="http://maven.apache.org/POM/4.0.0" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>
  <groupId>com.xiaopei</groupId>
  <artifactId>asking</artifactId>
  <packaging>war</packaging>
  <version>0.0.1-SNAPSHOT</version>
  <name>ssm3 Maven Webapp</name>
  <url>http://maven.apache.org</url>
  <build>
  	<pluginManagement>
  		<plugins>
  			<plugin>
  			<groupId>org.mortbay.jetty</groupId>
  			<artifactId>maven-jetty-plugin</artifactId>
  			<version>6.1.26</version>
  			</plugin>
  		</plugins>
  	</pluginManagement>
  </build>
  <dependencies>
		<dependency>
			<groupId>log4j</groupId>
			<artifactId>log4j</artifactId>
			<version>1.2.16</version>
		</dependency>
		
		<dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.4</version>
        </dependency>
		
		<dependency>
            <groupId>jstl</groupId>
            <artifactId>jstl</artifactId>
            <version>1.1.2</version>
        </dependency>

        <dependency>
            <groupId>taglibs</groupId>
            <artifactId>standard</artifactId>
            <version>1.1.2</version>
        </dependency>
        
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.8.2</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>commons-dbcp</groupId>
			<artifactId>commons-dbcp</artifactId>
			<version>1.4</version>
		</dependency>
		<dependency>
			<groupId>mysql</groupId>
			<artifactId>mysql-connector-java</artifactId>
			<version>5.1.9</version>
		</dependency>
		<dependency>
			<groupId>cglib</groupId>
			<artifactId>cglib</artifactId>
			<version>2.2</version>
		</dependency>
		<dependency>
			<groupId>org.freemarker</groupId>
			<artifactId>freemarker</artifactId>
			<version>2.3.16</version>
		</dependency>
		<dependency>
			<groupId>org.mybatis</groupId>
			<artifactId>mybatis</artifactId>
			<version>3.0.4</version>
		</dependency>
		<dependency>
			<groupId>org.mybatis</groupId>
			<artifactId>mybatis-spring</artifactId>
			<version>1.0.0</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-core</artifactId>
			<version>${spring.version}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-webmvc</artifactId>
			<version>${spring.version}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-beans</artifactId>
			<version>${spring.version}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-context</artifactId>
			<version>${spring.version}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-aop</artifactId>
			<version>${spring.version}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-tx</artifactId>
			<version>${spring.version}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-test</artifactId>
			<version>${spring.version}</version>
		</dependency>
		<dependency>
			<groupId>org.aspectj</groupId>
			<artifactId>aspectjrt</artifactId>
			<version>${aspectj.version}</version>
		</dependency>
		<dependency>
			<groupId>org.aspectj</groupId>
			<artifactId>aspectjweaver</artifactId>
			<version>${aspectj.version}</version>
		</dependency>
	</dependencies>
  <properties>
  	<spring.version>3.0.5.RELEASE</spring.version>
  	<aspectj.version>1.6.10</aspectj.version>
  </properties>
</project>

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文