在安装Maven时遇到问题。这是我的父母POM文件 AirportSys / 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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mavenDemo</groupId>
<artifactId>AirportSys</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>AirportRepo</module>
<module>AirportServices</module>
<module>AirportWeb</module>
</modules>
</project>
AirportRepo / 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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.mavenDemo</groupId>
<artifactId>AirportSys</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>AirportRepo</artifactId>
<url>http://maven.apache.org</url>
<properties>
<spring.version>3.2.0.RELEASE</spring.version>
<log4j.version>1.2.17</log4j.version>
<jdk.version>1.7.0</jdk.version>
</properties>
<dependencies>
<!-- Spring 3 dependencies -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</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>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>3.2.8.RELEASE</version>
</dependency>
<dependency>
<groupId>javax.portlet</groupId>
<artifactId>portlet-api</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency>
<!-- Mysql jars -->
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.6</version>
</dependency>
<!-- Hibernate jars -->
<!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-core -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.1.4.Final</version>
</dependency>
<!-- SpringFramework jars -->
<!-- https://mvnrepository.com/artifact/org.springframework/spring-core -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>3.2.16.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>3.2.8.RELEASE</version>
</dependency>
<dependency>
<groupId>javax.portlet</groupId>
<artifactId>portlet-api</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>
<!-- Tiles jars -->
<!-- https://mvnrepository.com/artifact/org.apache.tiles/tiles-jsp -->
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-jsp</artifactId>
<version>3.0.8</version>
</dependency>
<!-- Servlet jars -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
</dependencies>
</project>
AirportServices / 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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.mavenDemo</groupId>
<artifactId>AirportSys</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>AirportServices</artifactId>
<dependencies>
<dependency>
<groupId>com.mavenDemo</groupId>
<version>0.0.1-SNAPSHOT</version>
<artifactId>AirportRepo</artifactId>
</dependency>
</dependencies>
</project>
AiportWeb / pom.xml
<?xml version="1.0"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.mavenDemo</groupId>
<artifactId>AirportSys</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<groupId>com.mavenDemo</groupId>
<artifactId>AirportWeb</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>AirportWeb Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.mavenDemo</groupId>
<artifactId>AirportServices</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<finalName>AirportWeb</finalName>
</build>
</project>
maven安装时出现错误-
[INFO] Scanning for projects...
[WARNING] The POM for com.mavenDemo:AirportServices:jar:0.0.1-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[ERROR] Failed to execute goal on project AirportWeb: Could not resolve dependencies for project com.mavenDemo:AirportWeb:war:0.0.1-SNAPSHOT: Could not find artifact com.mavenDemo:AirportServices:jar:0.0.1-SNAPSHOT ->
我已经添加了所有依赖关系,这段代码是什么问题。
答案 0 :(得分:0)
关于错误消息为
[ERROR] Failed to execute goal on project AirportWeb:
Could not resolve dependencies for project
com.mavenDemo:AirportWeb:war:0.0.1-SNAPSHOT:
Could not find artifact com.mavenDemo:AirportServices:jar:0.0.1-SNAPSHOT
连同向我们展示在mvn install
目录中执行AirportWeb
的注释。
然后正确的位置应该是父项目目录AirportSys
。由于它是所有子模块的父级。 Maven会将其与这些子模块一起安装,并使其在我们的本地存储库中可用。
请访问以下网址,以获取更多信息,Guide to Working with Multiple Modules。