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

烧饼加肉 发布于 2012/11/19 20:33
阅读 5K+
收藏 0

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>


加载中
0
七念
七念

点项目 右键,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>

0
烧饼加肉
烧饼加肉

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

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

0
u
ug199313

我是按照官网上配置的

<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,具体百度

返回顶部
顶部