maven ssh2


1.cmd 转至 欲生成项目的目录执行:mvn archetype:create -DgroupId=org.jxsme.hj -DartifactId=sshinfo -DarchetypeArtifactId=maven-archetype-webapp

生成一个web项目

 

ftefno注:此时项目的目录下是否有pom.xml文件,会导致2种情况:

  1.如果没有,该目录只是个普通路径而已,执行

E:\workspace\UTP>mvn archetype:create -DgroupId=com.hp.utp -DartifactId=utp-web -DarchetypeArtifactId=maven-archetype-webapp
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-archetype-plugin:2.2:create (default-cli) @ standalone-pom ---
[WARNING] This goal is deprecated. Please use mvn archetype:generate instead
[INFO] Defaulting package to group ID: com.hp.utp
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating project from Old (1.x) Archetype: maven-archetype-webapp:RELEASE
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: com.hp.utp
[INFO] Parameter: packageName, Value: com.hp.utp
[INFO] Parameter: package, Value: com.hp.utp
[INFO] Parameter: artifactId, Value: utp-web
[INFO] Parameter: basedir, Value: E:\workspace\UTP
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] project created from Old (1.x) Archetype in dir: E:\workspace\UTP\utp-web
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.091s
[INFO] Finished at: Tue Jan 14 15:35:17 CST 2014
[INFO] Final Memory: 9M/79M
[INFO] ------------------------------------------------------------------------
E:\workspace\UTP>

    会在E:\workspace\UTP下生成utp-web文件夹,在

 

 

    

 

 

     2.如果有的话,其会被当做父目录的pom,供所有子项目使用(大型项目会包括jar,war等等),此时packaging要定义为pom

http://blog.csdn.net/yang_734664103/article/details/15783745

今天学习在本地搭建Maven工程时,执行了mvn archetype:generate 命令,报错。

 

Unable to create project from archetype [org.apache.maven.archetypes:maven-archetype-quickstart:1.1] 
Unable to add module to the current project as it is not of packaging type 'pom'

 

上网搜资料发现一个帖子,问题解决:

 

原文如下:

 

一开始以为是IDE出错了,很是着急,后来回想出错之前的操作。就在这之前,我备份了一个pom文件,然后直接移到了workspace的根目录下,心想是不是这个问题呢?带着疑问,我把这个pom.xml删掉了,然后再创建maven工程,果然不出所料,不再报错了。

 

为了确保是这个原因,后来google了一下,在国外一个论坛中碰到类似的问题,有个网友的回答摘抄如下:

 

Are you running the command from a directory that has an existing pom.xml file in it? I think that may be confusing Maven, as it thinks you're trying to add your new project as a sub-module of the project in the working directory.

 

原来是因为我在Workspace下放了个POM文件,造成了M2eclipse插件的误解,删掉就OK了。

 

  3.本项目比较复杂,所以选择UTP文件夹下新建pom.xml,供所有子项目使用。

      <packaging>pom</packaging>

       当执行mvn archetype:create -DgroupId=com.hp.utp -DartifactId=utp-web -DarchetypeArtifactId=maven-archetype-webapp以后

      (1)在父pom.xml的最后加上  <modules><module>utp-web</module></modules>

     (2)在子项目的pom.xml里加上  <parent> <groupId>com.hp.utp</groupId>  <artifactId>utp-project</artifactId> 

          <version>1.0-SNAPSHOT</version></parent>

 

     4.上面这行命令执行之后, src/main下怎么只有resources和webapp目录呢,怎么没有java目录呢?

      答:maven-archetype-webapp 生成的项目并没有完全标准的Maven目录结构,你要自己加进去。

2.设置代理服务器地址:http://192.168.2.196:8081

ftefno注:我本机~\.m2\conf\settings.xml里加proxy不起作用

3.在项目目录下pom.xml文件中添加struts2,spring,hibernate,servlet,jsp,junit包引入

ftefno注:

<?xml version="1.0" encoding="UTF-8"?>
<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.hp.utp</groupId>
  <artifactId>utp-project</artifactId>
  <packaging>pom</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>Maven for UTP</name>
  <url>http://maven.apache.org</url>
 
  <properties>
    <springframework.version>3.1.2</springframework.version> 
    <junit.version>4.8.1</junit.version>
    <struts.version>2.3.4.1</struts.version>
    <ibatis.version>2.3.4.726</ibatis.version>
    <mysql.version>5.1.21</mysql.version>
    <servlet.version>2.5</servlet.version>
    <log4j.version>1.2.17</log4j.version>
    <jsp.version>2.0</jsp.version>
  </properties>
 
  <dependencies>
   <dependency>
    <groupId>log4j</groupId>
    <artifactId>log4j</artifactId>
    <version>${log4j.version}</version>
   </dependency>
   
    <dependency>  
       <groupId>commons-dbcp</groupId>  
       <artifactId>commons-dbcp</artifactId>  
       <version>1.2.2</version>  
    </dependency>
          
    <dependency>  
       <groupId>commons-beanutils</groupId>  
       <artifactId>commons-beanutils</artifactId>  
       <version>1.7.0</version>  
    </dependency>
   
    <dependency>  
       <groupId>mysql</groupId>  
       <artifactId>mysql-connector-java</artifactId>  
       <version>${mysql.version}</version>  
    </dependency>
   
   <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-core</artifactId>
    <version>${springframework.version}</version>
   </dependency> 
   
   <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-beans</artifactId>
    <version>${springframework.version}</version>
   </dependency> 
   
   <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-context</artifactId>
    <version>${springframework.version}</version>
   </dependency> 
 

<!--
    <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-support</artifactId>
    <version>${springframework.version}</version>
   </dependency> 
 -->
   
   <dependency>
    <groupId>org.apache.struts</groupId>
    <artifactId>struts2-core</artifactId>
    <version>${struts.version}</version>
   </dependency>

    <dependency>  
      <groupId>org.apache.ibatis</groupId>  
      <artifactId>ibatis-sqlmap</artifactId>  
      <version>${ibatis.version}</version>  
    </dependency>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>${junit.version}</version>
      <scope>test</scope>
    </dependency>
   
  </dependencies>
  <modules>
    <module>utp-web</module>
  </modules>
</project>



4,执行mvn eclipse:eclipse -Dwtpversion=2.0 生成eclipse 项目

ftefno注:

  开始没有加-Dwtpversion=2.0

E:\workspace\UTP\utp-web>mvn eclipse:eclipse
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building utp-web Maven Webapp 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> maven-eclipse-plugin:2.9:eclipse (default-cli) @ utp-web >>>
[INFO]
[INFO] <<< maven-eclipse-plugin:2.9:eclipse (default-cli) @ utp-web <<<
[INFO]
[INFO] --- maven-eclipse-plugin:2.9:eclipse (default-cli) @ utp-web ---
[INFO] Using Eclipse Workspace: E:\workspace
[INFO] no substring wtp server match.
[INFO] Using as WTP server : Apache Tomcat v7.0
[INFO] Adding default classpath container: org.eclipse.jdt.launching.JRE_CONTAINER
Downloading: http://repo.maven.apache.org/maven2/javax/servlet/servlet-api/2.5/servlet-api-2.5.pom
Downloaded: http://repo.maven.apache.org/maven2/javax/servlet/servlet-api/2.5/servlet-api-2.5.pom (157 B at 0.1 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/javax/servlet/jsp/jsp-api/2.0/jsp-api-2.0.pom
Downloaded: http://repo.maven.apache.org/maven2/javax/servlet/jsp/jsp-api/2.0/jsp-api-2.0.pom (157 B at 0.2 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/log4j/log4j/1.2.17/log4j-1.2.17.pom
Downloaded: http://repo.maven.apache.org/maven2/log4j/log4j/1.2.17/log4j-1.2.17.pom (22 KB at 18.0 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/commons-dbcp/commons-dbcp/1.2.2/commons-dbcp-1.2.2.pom
Downloaded: http://repo.maven.apache.org/maven2/commons-dbcp/commons-dbcp/1.2.2/commons-dbcp-1.2.2.pom (10 KB at 9.8 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/commons-pool/commons-pool/1.3/commons-pool-1.3.pom
Downloaded: http://repo.maven.apache.org/maven2/commons-pool/commons-pool/1.3/commons-pool-1.3.pom (6 KB at 2.2 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/commons-beanutils/commons-beanutils/1.7.0/commons-beanutils-1.7.0.pom
Downloaded: http://repo.maven.apache.org/maven2/commons-beanutils/commons-beanutils/1.7.0/commons-beanutils-1.7.0.pom (357 B at 0.4 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/commons-logging/commons-logging/1.0.3/commons-logging-1.0.3.pom
Downloaded: http://repo.maven.apache.org/maven2/commons-logging/commons-logging/1.0.3/commons-logging-1.0.3.pom (866 B at 0.9 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/mysql/mysql-connector-java/5.1.21/mysql-connector-java-5.1.21.pom
Downloaded: http://repo.maven.apache.org/maven2/mysql/mysql-connector-java/5.1.21/mysql-connector-java-5.1.21.pom (2 KB at 1.2 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/springframework/spring-core/3.1.2/spring-core-3.1.2.pom
[WARNING] Missing POM for org.springframework:spring-core:jar:3.1.2
Downloading: http://repo.maven.apache.org/maven2/org/springframework/spring-beans/3.1.2/spring-beans-3.1.2.pom
[WARNING] Missing POM for org.springframework:spring-beans:jar:3.1.2
Downloading: http://repo.maven.apache.org/maven2/org/springframework/spring-context/3.1.2/spring-context-3.1.2.pom
[WARNING] Missing POM for org.springframework:spring-context:jar:3.1.2
Downloading: http://repo.maven.apache.org/maven2/org/springframework/spring-support/3.1.2/spring-support-3.1.2.pom
[WARNING] Missing POM for org.springframework:spring-support:jar:3.1.2
Downloading: http://repo.maven.apache.org/maven2/org/apache/struts/struts2-core/2.3.4.1/struts2-core-2.3.4.1.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/struts/struts2-core/2.3.4.1/struts2-core-2.3.4.1.pom (12 KB at 9.9 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/apache/struts/struts2-parent/2.3.4.1/struts2-parent-2.3.4.1.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/struts/struts2-parent/2.3.4.1/struts2-parent-2.3.4.1.pom (27 KB at 21.4 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/apache/struts/struts-master/9/struts-master-9.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/struts/struts-master/9/struts-master-9.pom (11 KB at 10.7 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/apache/struts/xwork/xwork-core/2.3.4.1/xwork-core-2.3.4.1.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/struts/xwork/xwork-core/2.3.4.1/xwork-core-2.3.4.1.pom (11 KB at 11.3 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/apache/commons/commons-lang3/3.1/commons-lang3-3.1.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/commons/commons-lang3/3.1/commons-lang3-3.1.pom (17 KB at 18.6 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/apache/commons/commons-parent/22/commons-parent-22.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/commons/commons-parent/22/commons-parent-22.pom (41 KB at 26.3 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/ognl/ognl/3.0.5/ognl-3.0.5.pom
Downloaded: http://repo.maven.apache.org/maven2/ognl/ognl/3.0.5/ognl-3.0.5.pom (6 KB at 6.4 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/freemarker/freemarker/2.3.19/freemarker-2.3.19.pom
Downloaded: http://repo.maven.apache.org/maven2/org/freemarker/freemarker/2.3.19/freemarker-2.3.19.pom (2 KB at 1.4 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/apache/ibatis/ibatis-sqlmap/2.3.4.726/ibatis-sqlmap-2.3.4.726.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/ibatis/ibatis-sqlmap/2.3.4.726/ibatis-sqlmap-2.3.4.726.pom (206 B at 0.2 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar
Downloaded: http://repo.maven.apache.org/maven2/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar (103 KB at 57.0 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/javax/servlet/jsp/jsp-api/2.0/jsp-api-2.0.jar
Downloaded: http://repo.maven.apache.org/maven2/javax/servlet/jsp/jsp-api/2.0/jsp-api-2.0.jar (48 KB at 31.2 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/log4j/log4j/1.2.17/log4j-1.2.17.jar
Downloaded: http://repo.maven.apache.org/maven2/log4j/log4j/1.2.17/log4j-1.2.17.jar (479 KB at 48.9 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/commons-dbcp/commons-dbcp/1.2.2/commons-dbcp-1.2.2.jar
Downloaded: http://repo.maven.apache.org/maven2/commons-dbcp/commons-dbcp/1.2.2/commons-dbcp-1.2.2.jar (119 KB at 62.8 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/commons-pool/commons-pool/1.3/commons-pool-1.3.jar
Downloaded: http://repo.maven.apache.org/maven2/commons-pool/commons-pool/1.3/commons-pool-1.3.jar (61 KB at 52.4 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/commons-beanutils/commons-beanutils/1.7.0/commons-beanutils-1.7.0.jar
Downloaded: http://repo.maven.apache.org/maven2/commons-beanutils/commons-beanutils/1.7.0/commons-beanutils-1.7.0.jar (185 KB at 75.9 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/commons-logging/commons-logging/1.0.3/commons-logging-1.0.3.jar
Downloaded: http://repo.maven.apache.org/maven2/commons-logging/commons-logging/1.0.3/commons-logging-1.0.3.jar (31 KB at 29.1 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/mysql/mysql-connector-java/5.1.21/mysql-connector-java-5.1.21.jar
Downloaded: http://repo.maven.apache.org/maven2/mysql/mysql-connector-java/5.1.21/mysql-connector-java-5.1.21.jar (809 KB at 74.8 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/springframework/spring-core/3.1.2/spring-core-3.1.2.jar
[WARNING] An error occurred during dependency resolution.
    Failed to retrieve org.springframework:spring-core-3.1.2
Caused by: Could not find artifact org.springframework:spring-core:jar:3.1.2 in central (http://repo.maven.apache.org/maven2)

Try downloading the file manually from the project website.

Then, install it using the command:
    mvn install:install-file -DgroupId=org.springframework -DartifactId=spring-core -Dversion=3.1.2 -Dpackaging=jar -Dfile=/path/to/file

Alternatively, if you host your own repository you can deploy the file there:
    mvn deploy:deploy-file -DgroupId=org.springframework -DartifactId=spring-core -Dversion=3.1.2 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -Dr
epositoryId=[id]

Path to dependency:
        1) com.hp.utp:utp-web:war:1.0-SNAPSHOT
        2) org.springframework:spring-core:jar:3.1.2


  org.springframework:spring-core:jar:3.1.2

from the specified remote repositories:
  central (http://repo.maven.apache.org/maven2, releases=true, snapshots=false)

[INFO] Unable to read jar manifest from E:\Maven_Repository\org\springframework\spring-core\3.1.2\spring-core-3.1.2.jar
Downloading: http://repo.maven.apache.org/maven2/org/springframework/spring-beans/3.1.2/spring-beans-3.1.2.jar
[WARNING] An error occurred during dependency resolution.
    Failed to retrieve org.springframework:spring-beans-3.1.2
Caused by: Could not find artifact org.springframework:spring-beans:jar:3.1.2 in central (http://repo.maven.apache.org/maven2)

Try downloading the file manually from the project website.

Then, install it using the command:
    mvn install:install-file -DgroupId=org.springframework -DartifactId=spring-beans -Dversion=3.1.2 -Dpackaging=jar -Dfile=/path/to/file

Alternatively, if you host your own repository you can deploy the file there:
    mvn deploy:deploy-file -DgroupId=org.springframework -DartifactId=spring-beans -Dversion=3.1.2 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -D
repositoryId=[id]

Path to dependency:
        1) com.hp.utp:utp-web:war:1.0-SNAPSHOT
        2) org.springframework:spring-beans:jar:3.1.2


  org.springframework:spring-beans:jar:3.1.2

from the specified remote repositories:
  central (http://repo.maven.apache.org/maven2, releases=true, snapshots=false)

[INFO] Unable to read jar manifest from E:\Maven_Repository\org\springframework\spring-beans\3.1.2\spring-beans-3.1.2.jar
Downloading: http://repo.maven.apache.org/maven2/org/springframework/spring-context/3.1.2/spring-context-3.1.2.jar
[WARNING] An error occurred during dependency resolution.
    Failed to retrieve org.springframework:spring-context-3.1.2
Caused by: Could not find artifact org.springframework:spring-context:jar:3.1.2 in central (http://repo.maven.apache.org/maven2)

Try downloading the file manually from the project website.

Then, install it using the command:
    mvn install:install-file -DgroupId=org.springframework -DartifactId=spring-context -Dversion=3.1.2 -Dpackaging=jar -Dfile=/path/to/file

Alternatively, if you host your own repository you can deploy the file there:
    mvn deploy:deploy-file -DgroupId=org.springframework -DartifactId=spring-context -Dversion=3.1.2 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url]
-DrepositoryId=[id]

Path to dependency:
        1) com.hp.utp:utp-web:war:1.0-SNAPSHOT
        2) org.springframework:spring-context:jar:3.1.2


  org.springframework:spring-context:jar:3.1.2

from the specified remote repositories:
  central (http://repo.maven.apache.org/maven2, releases=true, snapshots=false)

[INFO] Unable to read jar manifest from E:\Maven_Repository\org\springframework\spring-context\3.1.2\spring-context-3.1.2.jar
Downloading: http://repo.maven.apache.org/maven2/org/springframework/spring-support/3.1.2/spring-support-3.1.2.jar
[WARNING] An error occurred during dependency resolution.
    Failed to retrieve org.springframework:spring-support-3.1.2
Caused by: Could not find artifact org.springframework:spring-support:jar:3.1.2 in central (http://repo.maven.apache.org/maven2)

Try downloading the file manually from the project website.

Then, install it using the command:
    mvn install:install-file -DgroupId=org.springframework -DartifactId=spring-support -Dversion=3.1.2 -Dpackaging=jar -Dfile=/path/to/file

Alternatively, if you host your own repository you can deploy the file there:
    mvn deploy:deploy-file -DgroupId=org.springframework -DartifactId=spring-support -Dversion=3.1.2 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url]
-DrepositoryId=[id]

Path to dependency:
        1) com.hp.utp:utp-web:war:1.0-SNAPSHOT
        2) org.springframework:spring-support:jar:3.1.2


  org.springframework:spring-support:jar:3.1.2

from the specified remote repositories:
  central (http://repo.maven.apache.org/maven2, releases=true, snapshots=false)

[INFO] Unable to read jar manifest from E:\Maven_Repository\org\springframework\spring-support\3.1.2\spring-support-3.1.2.jar
Downloading: http://repo.maven.apache.org/maven2/org/apache/struts/struts2-core/2.3.4.1/struts2-core-2.3.4.1.jar
Downloaded: http://repo.maven.apache.org/maven2/org/apache/struts/struts2-core/2.3.4.1/struts2-core-2.3.4.1.jar (766 KB at 16.8 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/apache/struts/xwork/xwork-core/2.3.4.1/xwork-core-2.3.4.1.jar
Downloaded: http://repo.maven.apache.org/maven2/org/apache/struts/xwork/xwork-core/2.3.4.1/xwork-core-2.3.4.1.jar (614 KB at 76.8 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/apache/commons/commons-lang3/3.1/commons-lang3-3.1.jar
Downloaded: http://repo.maven.apache.org/maven2/org/apache/commons/commons-lang3/3.1/commons-lang3-3.1.jar (309 KB at 42.6 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/ognl/ognl/3.0.5/ognl-3.0.5.jar
Downloaded: http://repo.maven.apache.org/maven2/ognl/ognl/3.0.5/ognl-3.0.5.jar (223 KB at 66.0 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/freemarker/freemarker/2.3.19/freemarker-2.3.19.jar
Downloaded: http://repo.maven.apache.org/maven2/org/freemarker/freemarker/2.3.19/freemarker-2.3.19.jar (910 KB at 56.6 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/apache/ibatis/ibatis-sqlmap/2.3.4.726/ibatis-sqlmap-2.3.4.726.jar
Downloaded: http://repo.maven.apache.org/maven2/org/apache/ibatis/ibatis-sqlmap/2.3.4.726/ibatis-sqlmap-2.3.4.726.jar (376 KB at 35.6 KB/sec)
[INFO] Not writing settings - defaults suffice
[INFO] Wrote Eclipse project for "utp-web" to E:\workspace\UTP\utp-web.
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2:37.380s
[INFO] Finished at: Wed Jan 15 15:24:37 CST 2014
[INFO] Final Memory: 9M/61M
[INFO] ------------------------------------------------------------------------
E:\workspace\UTP\utp-web>

  生成后import到eclipse,直接run as不行,加上-Dwtpversion=2.0 后可以了  

E:\workspace\UTP\utp-web>mvn eclipse:eclipse -Dwtpversion=2.0
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building utp-web Maven Webapp 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> maven-eclipse-plugin:2.9:eclipse (default-cli) @ utp-web >>>
[INFO]
[INFO] <<< maven-eclipse-plugin:2.9:eclipse (default-cli) @ utp-web <<<
[INFO]
[INFO] --- maven-eclipse-plugin:2.9:eclipse (default-cli) @ utp-web ---
[INFO] Adding support for WTP version 2.0.
[INFO] Using Eclipse Workspace: E:\workspace
[INFO] no substring wtp server match.
[INFO] Using as WTP server : Apache Tomcat v7.0
[INFO] Adding default classpath container: org.eclipse.jdt.launching.JRE_CONTAINER
[WARNING] Missing POM for org.springframework:spring-support:jar:3.2.0.RELEASE
[WARNING] An error occurred during dependency resolution.
    Failed to retrieve org.springframework:spring-support-3.2.0.RELEASE
Caused by: Failure to find org.springframework:spring-support:jar:3.2.0.RELEASE in http://repo.maven.apache.org/maven2 was cached in the local
ory, resolution will not be reattempted until the update interval of central has elapsed or updates are forced

Try downloading the file manually from the project website.

Then, install it using the command:
    mvn install:install-file -DgroupId=org.springframework -DartifactId=spring-support -Dversion=3.2.0.RELEASE -Dpackaging=jar -Dfile=/path/to/

Alternatively, if you host your own repository you can deploy the file there:
    mvn deploy:deploy-file -DgroupId=org.springframework -DartifactId=spring-support -Dversion=3.2.0.RELEASE -Dpackaging=jar -Dfile=/path/to/fi
l=[url] -DrepositoryId=[id]

Path to dependency:
        1) com.hp.utp:utp-web:war:1.0-SNAPSHOT
        2) org.springframework:spring-support:jar:3.2.0.RELEASE


  org.springframework:spring-support:jar:3.2.0.RELEASE

from the specified remote repositories:
  central (http://repo.maven.apache.org/maven2, releases=true, snapshots=false)

[INFO] Unable to read jar manifest from E:\Maven_Repository\org\springframework\spring-support\3.2.0.RELEASE\spring-support-3.2.0.RELEASE.jar
[INFO] Not writing settings - defaults suffice
[INFO] Wrote Eclipse project for "utp-web" to E:\workspace\UTP\utp-web.
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.457s
[INFO] Finished at: Wed Jan 15 16:53:46 CST 2014
[INFO] Final Memory: 8M/110M
[INFO] ------------------------------------------------------------------------
E:\workspace\UTP\utp-web>

 

生成相应的.settings文件夹和.classpath、.project等文件。

ftefno注:导入eclipse,import->Existing Projects into Workspace,发现不是Web项目。

              在项目上右键->Properties->Project facets,勾选Dynamic Web Module,确定即可。

此时又出现新的问题:

但是本机的环境是1.6的!!通过查询http://my.oschina.net/wiselyming/blog/164470得知,修改下图中1.4为1.6即可。



5 打开eclipse导入工程,添加src/main/java目录,src/test/main,src/test/resources源文件目录

编写测试文件sayHello,及servlet 添加相应的测试,并生成war 文件..将该文件放至tomcat中进行测试.

 

ftefno注:

E:\workspace\UTP\utp-web>mvn package
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building utp-web Maven Webapp 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ utp-web ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ utp-web ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ utp-web ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory E:\workspace\UTP\utp-web\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) @ utp-web ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ utp-web ---
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-booter/2.12.4/surefire-booter-2.12.4.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-booter/2.12.4/surefire-booter-2.12.4.pom (3 KB at 1.6 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-api/2.12.4/surefire-api-2.12.4.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-api/2.12.4/surefire-api-2.12.4.pom (3 KB at 2.1 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/surefire/maven-surefire-common/2.12.4/maven-surefire-common-2.12.4.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/surefire/maven-surefire-common/2.12.4/maven-surefire-common-2.12.4.pom (6 KB at 4.8 K
B/sec)
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugin-tools/maven-plugin-annotations/3.1/maven-plugin-annotations-3.1.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/plugin-tools/maven-plugin-annotations/3.1/maven-plugin-annotations-3.1.pom (2 KB at 1
.4 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugin-tools/maven-plugin-tools/3.1/maven-plugin-tools-3.1.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/plugin-tools/maven-plugin-tools/3.1/maven-plugin-tools-3.1.pom (16 KB at 10.0 KB/sec)

Downloading: http://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.0.8/plexus-utils-3.0.8.pom
Downloaded: http://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.0.8/plexus-utils-3.0.8.pom (4 KB at 2.9 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus/3.2/plexus-3.2.pom
Downloaded: http://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus/3.2/plexus-3.2.pom (19 KB at 12.4 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-api/2.12.4/surefire-api-2.12.4.jar
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-booter/2.12.4/surefire-booter-2.12.4.jar
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugin-tools/maven-plugin-annotations/3.1/maven-plugin-annotations-3.1.jar
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/surefire/maven-surefire-common/2.12.4/maven-surefire-common-2.12.4.jar
Downloading: http://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.0.8/plexus-utils-3.0.8.jar
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/plugin-tools/maven-plugin-annotations/3.1/maven-plugin-annotations-3.1.jar (14 KB at
7.1 KB/sec)
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-booter/2.12.4/surefire-booter-2.12.4.jar (34 KB at 14.3 KB/sec)
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-api/2.12.4/surefire-api-2.12.4.jar (115 KB at 34.2 KB/sec)
Downloaded: http://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.0.8/plexus-utils-3.0.8.jar (227 KB at 38.5 KB/sec)
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/surefire/maven-surefire-common/2.12.4/maven-surefire-common-2.12.4.jar (257 KB at 28.
8 KB/sec)
[INFO] No tests to run.
[INFO]
[INFO] --- maven-war-plugin:2.2:war (default-war) @ utp-web ---
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/maven-archiver/2.5/maven-archiver-2.5.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/maven-archiver/2.5/maven-archiver-2.5.pom (5 KB at 4.7 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-archiver/2.1/plexus-archiver-2.1.pom
Downloaded: http://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-archiver/2.1/plexus-archiver-2.1.pom (3 KB at 2.6 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-io/2.0.2/plexus-io-2.0.2.pom
Downloaded: http://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-io/2.0.2/plexus-io-2.0.2.pom (2 KB at 1.8 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-interpolation/1.15/plexus-interpolation-1.15.pom
Downloaded: http://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-interpolation/1.15/plexus-interpolation-1.15.pom (1018 B at 1.1 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/com/thoughtworks/xstream/xstream/1.3.1/xstream-1.3.1.pom
Downloaded: http://repo.maven.apache.org/maven2/com/thoughtworks/xstream/xstream/1.3.1/xstream-1.3.1.pom (12 KB at 11.5 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/com/thoughtworks/xstream/xstream-parent/1.3.1/xstream-parent-1.3.1.pom
Downloaded: http://repo.maven.apache.org/maven2/com/thoughtworks/xstream/xstream-parent/1.3.1/xstream-parent-1.3.1.pom (14 KB at 12.9 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-filtering/1.0-beta-2/maven-filtering-1.0-beta-2.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-filtering/1.0-beta-2/maven-filtering-1.0-beta-2.pom (4 KB at 4.1 KB/sec)

Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-shared-components/10/maven-shared-components-10.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-shared-components/10/maven-shared-components-10.pom (9 KB at 7.4 KB/sec)

Downloading: http://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-interpolation/1.6/plexus-interpolation-1.6.pom
Downloaded: http://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-interpolation/1.6/plexus-interpolation-1.6.pom (3 KB at 2.7 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/maven-archiver/2.5/maven-archiver-2.5.jar
Downloading: http://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-io/2.0.2/plexus-io-2.0.2.jar
Downloading: http://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-interpolation/1.15/plexus-interpolation-1.15.jar
Downloading: http://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-archiver/2.1/plexus-archiver-2.1.jar
Downloading: http://repo.maven.apache.org/maven2/com/thoughtworks/xstream/xstream/1.3.1/xstream-1.3.1.jar
Downloaded: http://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-io/2.0.2/plexus-io-2.0.2.jar (57 KB at 38.3 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-filtering/1.0-beta-2/maven-filtering-1.0-beta-2.jar
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/maven-archiver/2.5/maven-archiver-2.5.jar (22 KB at 10.3 KB/sec)
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-filtering/1.0-beta-2/maven-filtering-1.0-beta-2.jar (33 KB at 32.4 KB/se
c)
Downloaded: http://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-interpolation/1.15/plexus-interpolation-1.15.jar (60 KB at 21.6 KB/sec)
Downloaded: http://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-archiver/2.1/plexus-archiver-2.1.jar (181 KB at 27.5 KB/sec)
Downloaded: http://repo.maven.apache.org/maven2/com/thoughtworks/xstream/xstream/1.3.1/xstream-1.3.1.jar (422 KB at 33.6 KB/sec)
[INFO] Packaging webapp
[INFO] Assembling webapp [utp-web] in [E:\workspace\UTP\utp-web\target\utp-web]
[INFO] Processing war project
[INFO] Copying webapp resources [E:\workspace\UTP\utp-web\src\main\webapp]
[INFO] Webapp assembled in [32723 msecs]
[INFO] Building war: E:\workspace\UTP\utp-web\target\utp-web.war
[INFO] WEB-INF\web.xml already added, skipping
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1:24.693s
[INFO] Finished at: Thu Jan 16 14:19:00 CST 2014
[INFO] Final Memory: 9M/88M
[INFO] ------------------------------------------------------------------------
E:\workspace\UTP\utp-web>

 将在E:\workspace\UTP\utp-web\target下生成utp-web.war(里面包含所有要依赖的lib),将此war放到tomcat\webapps下,即可发布。

 

ftefno注:在web.xml中添加<listener>
  <listener-class>
   org.springframework.web.context.ContextLoaderListener
  </listener-class>
 </listener>后,报错说java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

   (1)不是http://blog.csdn.net/xxben/article/details/7362138说的问题

   (2)在eclilpse里也配置了Deploymeng Assembly

            (3)发现是pom.xml少写了  

   <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-web</artifactId>
    <version>${springframework.version}</version>
   </dependency> 


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中进行测试

posted @ 2014-01-14 16:02  ftefno  阅读(166)  评论(0)    收藏  举报