我已經創建了一個包含一些我想用於我的項目的常見依賴項的pom文件。該pom有一個類型的包裝袋。我已經將它推送到我的nexus存儲庫:https://oss.sonatype.org/service/local/repositories/snapshots/content/com/gwidgets/gwt-spring-boot-starter/1.0-SNAPSHOT/gwt-spring-boot-starter-1.0-20170526.141419-3.pom,現在我正試圖將其導入到其他項目中,但依賴項未由maven解決。以下是完整的POM:無法將pom依賴項導入到另一個
<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>demo</name>
<description>Demo project</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.3.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.gwidgets</groupId>
<artifactId>gwt-spring-boot-starter</artifactId>
<version>1.0-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>com.gwidgets</groupId>
<artifactId>gwt-spring-boot-starter</artifactId>
<version>1.0-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<repositories>
<repository>
<id>snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<webResources>
<resource>
<directory>src/main/webapp</directory>
</resource>
</webResources>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
<executions>
<execution>
<id>war</id>
<phase>compile</phase>
<goals>
<goal>war</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
我曾嘗試加入dependencyManagement
部分,沒有任何的運氣。我錯過了什麼嗎? maven不允許嗎?任何幫助都會很棒。以下是我在嘗試執行GWT編譯時遇到的錯誤:
package com.google.gwt.core.client does not exist
cannot find symbol: class EntryPoint
這只是表示依賴關係不存在。
對不起!有些人試圖關閉它,因爲他說這沒有什麼可做的maven,這是一個純粹的maven問題。他認爲他比這裏的每個人都更聰明。我注意到你的答案。如果它有效,比你可以重新發布它,我會將它標記爲已接受的答案。 –
導入範圍只能在'dependencyManagement'中使用。 – khmarbaise
我想要實現的就是擁有一堆依賴關係並將它們收集到一個pom中,然後將該pom導入多個項目中,這些項目將以可傳遞的方式導入其依賴項,這是否可以使用Maven實現? –