[英]Failed to execute goal on project AirportWeb
我在安裝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 ->
我已經添加了所有依賴關系,此代碼中的問題是什么。
關於錯誤消息為
[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
以及在AirportWeb
目錄中執行mvn install
時向我們顯示的注釋。
然后,正確的位置應該是父項目目錄AirportSys
。 由於它是所有子模塊的父級。 Maven會將其與這些子模塊一起安裝,並使其在我們的本地存儲庫中可用。
請訪問以下內容以獲取更多信息, 《使用多個模塊的指南》 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.