使用maven generate生成Web应用程序

时间:2013-07-31 17:56:51

标签: java spring maven

我使用maven使用mvn archetype:generate生成了一个项目结构,项目结构如下: web应用     -src         -主要             -java               -com                 织网                   -App.java         -test

我已尝试按照create web app

链接上的教程

运行mvn依赖:analyze-dep-mgt

但项目结构仍然不同。

虽然我使用它 mvn archetype:generate -DgroupId={project-packaging} -DartifactId={project-name} -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false,我丢失了Pom文件

我错在哪里因为结构不同而我的web.xml没有生成?

C:\Users\user\workspace\webappspringapp\webapp>mvn dependency:analyze-dep-mgt
[INFO] Scanning for projects...
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR]   The project com.webapp:webapp:1.0-SNAPSHOT (C:\Users\user\workspace\we
bappspringapp\webapp\pom.xml) has 3 errors
[ERROR]     'dependencies.dependency.version' for org.springframework:spring-cor
e:jar must be a valid version but is '${spring.version}'. @ line 14, column 13
[ERROR]     'dependencies.dependency.version' for org.springframework:spring-web
:jar must be a valid version but is '${spring.version}'. @ line 20, column 13
[ERROR]     'dependencies.dependency.version' for org.springframework:spring-web
mvc:jar must be a valid version but is '${spring.version}'. @ line 26, column 13

[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildin
gException

Pom.xml部分

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

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

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

1 个答案:

答案 0 :(得分:1)

mvn dependency:tree

这用于查看当前正在构建的项目的依赖关系层次结构。它将输出Maven构建过程实际使用的已解析依赖关系树。