我正在开发带有球衣的休息服务。该项目有几个模块。我的外观模块的依赖项是:
<?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>
<artifactId>com-myproject</artifactId>
<groupId>com.myproject</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<groupId>com.myproject.facade</groupId>
<artifactId>com-myproject-facade</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>com-myproject-facade Jersey Webapp</name>
<properties>
<jersey-version>1.8</jersey-version>
</properties>
<dependencies>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>${jersey-version}</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-json</artifactId>
<version>${jersey-version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-client</artifactId>
<version>${jersey-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.glassfish.distributions</groupId>
<artifactId>web-all</artifactId>
<version>10.0-build-20080430</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.glassfish.embedded</groupId>
<artifactId>gf-embedded-api</artifactId>
<version>1.0-alpha-4</version>
<scope>test</scope>
</dependency>
<!-- Hyperlinking -->
</dependencies>
<repositories>
<repository>
<id>glassfish.java.net</id>
<name>GlassFish Maven Repository</name>
<url>http://download.java.net/maven/glassfish</url>
</repository>
<repository>
<id>m2.java.net</id>
<name>Java.net Maven 2 Repository</name>
<url>http://download.java.net/maven/2</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>m2.java.net</id>
<name>Java.net Maven 2 Repository</name>
<url>http://download.java.net/maven/2</url>
</pluginRepository>
</pluginRepositories>
<build>
<finalName>com-bachelor-facade</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<inherited>true</inherited>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.glassfish</groupId>
<artifactId>maven-glassfish-plugin</artifactId>
</plugin>
</plugins>
有用。
当我为带有球衣的超媒体添加新的依赖项时:
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server-linking</artifactId>
<version>${jersey-version}</version>
</dependency>
我在这个外观项目和所有其他同级模块中收到一个 pom 错误,因为它们依赖于外观模块。
在外观项目中,我收到有关缺少工件的错误:
22.06.12 11:11:02 MESZ: Missing artifact com.sun.jersey:jersey-server:jar:1.8:compile
22.06.12 11:11:02 MESZ: Missing artifact asm:asm:jar:3.1:compile
22.06.12 11:11:02 MESZ: Missing artifact com.sun.jersey:jersey-core:jar:1.8:compile
22.06.12 11:11:02 MESZ: Missing artifact com.sun.jersey:jersey-json:jar:1.8:compile
22.06.12 11:11:02 MESZ: Missing artifact org.codehaus.jettison:jettison:jar:1.1:compile
22.06.12 11:11:02 MESZ: Missing artifact stax:stax-api:jar:1.0.1:compile
等等。
其他模块依赖于这个项目并得到错误:
Build errors for com-myproject-core; org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project com-myproject-core: Could not resolve dependencies for project com.myproject.core:com-bachelor-myproject:war:1.0-SNAPSHOT: Failed to collect dependencies for [com.myproject.facade:com-myproject-facade:jar:1.0-SNAPSHOT (compile), com.sun.jersey:jersey-server:jar:1.8 (compile), com.sun.jersey:jersey-json:jar:1.8 (compile), junit:junit:jar:4.8.2 (test), com.sun.jersey:jersey-client:jar:1.8 (test), org.glassfish.distributions:web-all:jar:10.0-build-20080430 (test), org.glassfish.embedded:gf-embedded-api:jar:1.0-alpha-4 (test), log4j:log4j:jar:1.2.14 (provided)]
我想我只需要使用 maven 安装更改的项目,然后其他项目得到修复。但是我不能进行 maven 安装,因为更改的项目 pom 也是由于缺少工件而导致的红色。如何解决这个问题?