我正在做一个JAR-与依赖性定制Azure的服务总线客户,在我的情况下(卡洛斯/罗伯特)/ issue#466解决方法(行家遮阳帘插件)无法正常工作。
我总是得到同样的错误:
Service or property not registered: com.microsoft.windowsazure.services.servicebus.ServiceBusContract class com.sun.jersey.api.client.Client
NB:我刚刚发现了另一个公开售票是可能涉及到同样的问题在这里:issue#465
此错误的根本原因是以下错误资源:
META-INF/services/com.microsoft.windowsazure.core.Builder$Exports
两个azure-core
和azure-servicebus
(0.8.3)的依赖使用相同的文件(相同的名称和s ame位置),它嵌入了“包输出”列表。 这2个文件应合并。
我的悲伤解决方法是使用2个处决行家组装的:
- 步骤A)第一执行使得依存关系目录,
- 步骤B)第二执行追加我的版本固定
Builder$Exports
资源的,删除MS签名的文件(安全问题),并创建一个最终的jar文件。
此解决方案尚不可接受,因为固定资源未从天青依赖中选取。我有我自己的额外资源。但是今天我没有其他的解决方法。
固定MS合并结果文件中(src /主/资源)为:
文件名
META-INF/services/com.microsoft.windowsazure.core.Builder$Exports
文件内容
com.microsoft.windowsazure.services.servicebus.Exports
com.microsoft.windowsazure.services.servicebus.implementation.Exports
com.microsoft.windowsazure.core.pipeline.apache.Exports
com.microsoft.windowsazure.core.pipeline.jersey.Exports
com.microsoft.windowsazure.core.utils.Exports
com.microsoft.windowsazure.credentials.Exports
com.microsoft.windowsazure.management.configuration.Exports
POM插件定义:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>dir-jar-with-dependencies</id><!-- step A -->
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/assembly/dir_jardeps.xml</descriptor>
</descriptors>
<finalName>busclient</finalName>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
</execution>
<execution>
<id>jar-with-dependencies-ms-patch</id><!-- step B -->
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<archive>
<manifest>
<mainClass>${mainclass}</mainClass>
</manifest>
</archive>
<descriptors>
<descriptor>src/assembly/jardeps_mspatch.xml</descriptor>
</descriptors>
<finalName>busclient</finalName>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
</execution>
文件src/assembly/dir_jardeps.xml
:
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">
<id>dir-jar-with-dependencies</id>
<formats>
<format>dir</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<outputDirectory>/</outputDirectory>
<useProjectArtifact>true</useProjectArtifact>
<unpack>true</unpack>
<scope>runtime</scope>
</dependencySet>
</dependencySets>
</assembly>
文件src/assembly/dir_jardeps.xml
:
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">
<id>dir-jar-with-dependencies</id>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>${project.build.directory}/classes/META-INF</directory>
<outputDirectory>META-INF</outputDirectory>
</fileSet>
<fileSet>
<directory>${project.build.directory}/busclient</directory>
<outputDirectory>/</outputDirectory>
<excludes>
<exclude>META-INF/services/com.microsoft.windowsazure.core.Builder$Exports</exclude>
<!-- MS jars are signed : remove signatures -->
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</fileSet>
</fileSets>
</assembly>
我无法使用这个插件来解决它:(截至今天,我唯一的解决方法是手动合并所产生的“ com.microsoft.windowsazure.core.Builder $ Exports“ – boly38 2015-10-21 13:13:17