1

I have a project that includes, among others, Apache Pivot and Neo4j. My project compiles and runs. When I try to add Neo4j/Spatial:

<dependency>
  <groupId>org.neo4j</groupId>
  <artifactId>neo4j-spatial</artifactId>
  <version>0.11-SNAPSHOT</version>
</dependency>

The project compiles but will not run. The compiler sources the error at one of the BXML files:

org.apache.pivot.serialization.SerializationException: java.util.ServiceConfigurationError: javax.imageio.spi.ImageOutputStreamSpi: Provider com.sun.media.imageioimpl.stream.ChannelImageOutputStreamSpi could not be instantiated: java.lang.IllegalArgumentException: vendorName == null!

I can't understand how adding a dependency can break the project at runtime. I did not change any code. I'll post whatever code is necessary as asked.

UPDATE: I've tried a previous, stable version with the same result. Also, I've added "vendor" and version information to my jar manifest that seems to fix the vendorName == null error and causes the project to hang on close rather than open. But my question, which I'll rephrase here, is the same.

How does adding a dependency, without changing code, cause a functioning project to fail at runtime? I don't understand how adding the dependency changes the execution if I don't call it.

4

1 回答 1

0

版本控制可能存在问题。如果您添加了一个依赖项,并且您有另一个具有相同依赖项但版本不同的库,则 Maven 的通常行为是导入最新版本,有时这可能会破坏依赖于旧版本的代码,因为到更改的界面或其他任何内容。

因此,如果 A 依赖于 B v1,而 C 依赖于 Bv2,那么当您添加 C 时,它会在有效 POM 中用 Bv2 覆盖 Bv1,这在理论上可能会破坏它。

我确信有办法解决这个问题,但我不是 Maven 专家。因此,当您导入新事物时,请检查您的有效 POM 以了解对版本的更改。

于 2014-05-27T16:09:19.680 回答