0

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

我已尝试按照链接创建 Web 应用程序上的教程进行操作

运行 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>
4

1 回答 1

1
mvn dependency:tree

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

于 2013-07-31T18:20:12.957 回答