搭建一个Maven的ssh2项目步骤
2013-05-29 12:22
387 查看
1.cmd 转至 欲生成项目的目录执行:mvn archetype:create -DgroupId=org.jxsme.hj -DartifactId=sshinfo -DarchetypeArtifactId=maven-archetype-webapp
生成一个web项目
2.设置代理服务器地址:http://192.168.2.196:8081
3.在项目目录下pom.xml文件中添加struts2,spring,hibernate,servlet,jsp,junit包引入
<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>org.jxsme.hj</groupId>
<artifactId>sshinfo</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>sshinfo Maven Webapp</name>
<url>http://maven.apache.org</url>
<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>2.0.11.2</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-sitemesh-plugin</artifactId>
<version>2.0.11.2</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-spring-plugin</artifactId>
<version>2.0.11.2</version>
</dependency>
<!-- Servlet & Jsp -->
<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.1.1</version>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.2.2</version>
</dependency>
<!-- spring 2.5 -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-hibernate3</artifactId>
<version>2.0.8</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>2.5.5</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>2.5.5</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>2.5.5</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>2.5.5</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>2.5.5</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>2.5.5</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>2.5.5</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>2.5.5</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
<version>2.5.5</version>
</dependency>
<!-- mysql-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.6</version>
</dependency>
<dependency>
<groupId>proxool</groupId>
<artifactId>proxool</artifactId>
<version>0.8.3</version>
</dependency>
<!-- hibernate 3.3-->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>3.3.1.GA</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-annotations</artifactId>
<version>3.3.0.ga</version>
</dependency>
</dependencies>
<build>
<finalName>sshinfo</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
<encoding>utf-8</encoding>
</configuration>
</plugin>
</plugins>
</build>
</project>
4,执行mvn eclipse:eclipse 生成eclipse 项目
5 打开eclipse导入工程,添加src/main/java目录,src/test/main,src/test/resources源文件目录
编写测试文件sayHello,及servlet 添加相应的测试,并生成war 文件..将该文件放至tomcat中进行测试.
6.添加struts支持action测试.
7.在applicationContent.xml中配置hibernate及事务代理.
8.连接数据库,生成hbm.xml,pojo文件
9.编写 dao.service,serviceimpl等到类文件....
10.编写junit Dao测试,
11.编写 struts2.Actioin 及测试类.
12.执行编译打包,,mvn install
13.放至tomcat中进行测试
生成一个web项目
2.设置代理服务器地址:http://192.168.2.196:8081
3.在项目目录下pom.xml文件中添加struts2,spring,hibernate,servlet,jsp,junit包引入
<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>org.jxsme.hj</groupId>
<artifactId>sshinfo</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>sshinfo Maven Webapp</name>
<url>http://maven.apache.org</url>
<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>2.0.11.2</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-sitemesh-plugin</artifactId>
<version>2.0.11.2</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-spring-plugin</artifactId>
<version>2.0.11.2</version>
</dependency>
<!-- Servlet & Jsp -->
<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.1.1</version>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.2.2</version>
</dependency>
<!-- spring 2.5 -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-hibernate3</artifactId>
<version>2.0.8</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>2.5.5</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>2.5.5</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>2.5.5</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>2.5.5</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>2.5.5</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>2.5.5</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>2.5.5</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>2.5.5</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
<version>2.5.5</version>
</dependency>
<!-- mysql-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.6</version>
</dependency>
<dependency>
<groupId>proxool</groupId>
<artifactId>proxool</artifactId>
<version>0.8.3</version>
</dependency>
<!-- hibernate 3.3-->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>3.3.1.GA</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-annotations</artifactId>
<version>3.3.0.ga</version>
</dependency>
</dependencies>
<build>
<finalName>sshinfo</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
<encoding>utf-8</encoding>
</configuration>
</plugin>
</plugins>
</build>
</project>
4,执行mvn eclipse:eclipse 生成eclipse 项目
5 打开eclipse导入工程,添加src/main/java目录,src/test/main,src/test/resources源文件目录
编写测试文件sayHello,及servlet 添加相应的测试,并生成war 文件..将该文件放至tomcat中进行测试.
6.添加struts支持action测试.
7.在applicationContent.xml中配置hibernate及事务代理.
8.连接数据库,生成hbm.xml,pojo文件
9.编写 dao.service,serviceimpl等到类文件....
10.编写junit Dao测试,
11.编写 struts2.Actioin 及测试类.
12.执行编译打包,,mvn install
13.放至tomcat中进行测试
相关文章推荐
- 自己搭建一个Maven项目
- SpringMvc+MyBatis+MySQL+Maven+Redis搭建一个基础的web项目
- 用Rails-2.1.6搭建一个web项目的步骤(修正)
- 搭建一个maven框架的ssm项目
- 搭建 maven 分布式开发项目的步骤
- maven -- 学习笔记(四)实现在Eclipse用maven搭建springmvc项目(附构建步骤和详细实现代码)
- 用maven搭建多模块企业级项目(步骤详细)
- 使用Maven搭建SpringMVC项目的步骤(图文教程)
- [使用心得]maven2之m2eclipse使用手册之六使用Maven2插件创建一个简单的SSH2项目之tomcat篇
- 快速搭建一个Vue项目的步骤
- 使用idea搭建一个简单的SSM框架:(1)使用idea创建maven项目
- 简单搭建一个聚合的maven项目(手动完成)
- HzhJava框架搭建一:Eclipse+Maven创建一个web项目
- 新建一个 Maven 项目(webapp 类型)的步骤
- Maven搭建一个基础SSM项目所需要的依赖
- 如何在电脑上搭建一个私服,实现maven项目的上传和下载?
- 通过spring boot+maven搭建的一个简单项目
- Maven项目的框架搭建步骤-转载,有几处错误,注意保留学习使用
- maven搭建整合大型ssm项目步骤
- [使用心得]maven2之m2eclipse使用手册之六使用Maven2插件创建一个简单的SSH2项目之glassfish篇(二)