问题
I've got quite strange problem with pi4j library to Raspberry Pi. I have Maven project in Eclipse and just added repository and dependency for pi4j like this:
<repository>
<id>oss-snapshots-repo</id>
<name>Sonatype OSS Maven Repository</name>
<url>https://oss.sonatype.org/content/groups/public</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
<dependency>
<groupId>com.pi4j</groupId>
<artifactId>pi4j-core</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
I don't have any pi4j code in my project and I get this error while doing mvn install:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:2.1:shade (default) on project kosciol-main: Error creating shaded jar: error in opening zip file d:\Programy\apache-maven-3.1.1\m2\repositories\com\pi4j\pi4j-native\1.0-SNAPSHOT\pi4j-native-1.0-SNAPSHOT-hard-float.so -> [Help 1]
If I delete dependency, project compiles without errors... I tried to delete this pi4j repository from m2 folder but this didn't help. How can I solve it?
回答1:
Try to specify the scope of the dependency as "provided", like this:
<dependency>
<groupId>com.pi4j</groupId>
<artifactId>pi4j-core</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
来源:https://stackoverflow.com/questions/20098271/maven-project-with-pi4j-library-error-in-opening-zip-file