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.
There can be issues with versioning. If you add a dependency, and you have another library which has the same dependency but a different version, the usual behaviour of Maven is for the latest version to be imported, and occasionally that can break the code that depended on the old version, due to a changed interface or whatever.
So if A depends on B v1, and C depends on Bv2, then when you add C, it overwrites Bv1 with Bv2 in the effective POM, which in theory could break it.
I am sure that there is a way around this, but I am not an expert with Maven. SO check your effective POM for changes to versions when you import the new thing.