Maven2创建Struts 2.2.1项目
2010-08-27 16:01
393 查看
Struts2 2.2.1 已经发布,apache 的maven库也已经可以使用。
pom.xml配置:
另外:2.2.1版本需要包含javassist这个包,否则无法运行!
mvn archetype:generate -B -DgroupId=example -DartifactId=example -DarchetypeGroupId=org.apache.struts -DarchetypeArtifactId=struts2-archetype-starter -DarchetypeVersion=2.2.1 -DremoteRepositories=https://repository.apache.org/content/groups/staging/
在尝试使用2.2.1版的struts2-archetype-starter创建项目时,出现[ERROR] Error reading POM 错误,更换了几个库问题依旧,于是尝试使用struts2-archetype-blank,成功创建项目,但打开pom.xml却发现其中对struts2依赖项引用的版本还停留在2.1.8.1 ,如果要使用2.2.1只能手动修改。
pom.xml配置:
<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>example</groupId> <artifactId>example</artifactId> <packaging>war</packaging> <version>1.0-SNAPSHOT</version> <name>Struts2 Starter</name> <url>http://maven.apache.org</url> <properties> <struts2.version>2.2.1</struts2.version> </properties> <repositories> <repository> <id>apache.nexus</id> <name>ASF Nexus Staging</name> <url>https://repository.apache.org/content/groups/staging/</url> </repository> </repositories> <dependencies> <!-- Junit --> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> <!-- Struts 2 --> <dependency> <groupId>org.apache.struts</groupId> <artifactId>struts2-core</artifactId> <version>${struts2.version}</version> </dependency> <dependency> <groupId>org.apache.struts</groupId> <artifactId>struts2-config-browser-plugin</artifactId> <version>${struts2.version}</version> </dependency> <dependency> <groupId>org.apache.struts</groupId> <artifactId>struts2-sitemesh-plugin</artifactId> <version>${struts2.version}</version> </dependency> <dependency> <groupId>org.apache.struts</groupId> <artifactId>struts2-spring-plugin</artifactId> <version>${struts2.version}</version> </dependency> <dependency> <groupId>javassist</groupId> <artifactId>javassist</artifactId> <version>3.7.1.GA</version> </dependency> <!-- Servlet & Jsp --> <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> <version>2.5</version> <scope>provided</scope> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> <version>2.4</version> <scope>provided</scope> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>jsp-api</artifactId> <version>2.0</version> <scope>provided</scope> </dependency> <!-- Jakarta Commons --> <dependency> <groupId>commons-fileupload</groupId> <artifactId>commons-fileupload</artifactId> <version>1.2.1</version> </dependency> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.16</version> </dependency> </dependencies> <build> <finalName>example</finalName> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.5</source> <target>1.5</target> </configuration> </plugin> <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>maven-jetty-plugin</artifactId> <version>6.1.25</version> <configuration> <scanIntervalSeconds>10</scanIntervalSeconds> </configuration> </plugin> </plugins> </build> </project>
另外:2.2.1版本需要包含javassist这个包,否则无法运行!
相关文章推荐
- maven创建struts项目
- 照葫芦画瓢系列之Java --- eclipse下使用maven创建Struts 2项目
- 使用Maven实现Struts2+Hibernate4+Spring3整合SSH框架(一):Maven项目创建
- eclipse maven 创建struts项目
- eclipse创建maven的web项目
- Maven学习总结(七)——eclipse中使用Maven创建Web项目
- 1.0 在eclipse中使用maven创建springMVC项目
- Maven学习之路六(创建Maven项目)
- eclipse 使用 maven-archetype-quickstart 创建项目报错
- maven创建复合工程项目
- Maven创建项目-Missing library: xdoclet-1.2.1.jar. Select the home directory for XDoclet. 1.2.1
- myEclipse创建maven项目
- Maven3路程(四)用Maven创建Struts2项目
- eclipse 中创建 整合springmvc+mybatis+maven 的java web项目步骤,以及maven仓库配置
- 使用maven创建web项目
- eclipse 用maven创建javaWeb项目
- eclipse下maven项目的创建以及问题的解决
- 简述泛型、用Maven创建Web项目以及在Web项目上整合SpringMVC
- Maven开发Android指南 3 使用Android Maven Archetypes 创建新项目
- Maven创建servlet webapp项目并在Tomcat上部署