1

我正在尝试使用shade插件打包我的项目,但出现以下错误:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:2.1:shade (default) on project HiveBrowser: Error creating shaded jar: Could not resolve dependencies for project HiveBrowser:HiveBrowser:jar:1.0: Could not find artifact javax.jnlp:jnlp:jar:1.6 in central (http://repo.maven.apache.org/maven2) -> [Help 1]

这是我的 pom 构建插件条目:

<plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <dependencies>
                <dependency>
                    <groupId>javax.jnlp</groupId>
                    <artifactId>jnlp</artifactId>
                    <version>1.6</version>
                    <scope>system</scope>
                    <systemPath>${java.home}/sample/jnlp/servlet/jnlp.jar</systemPath>
                </dependency>
            </dependencies>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>shade</goal>
                    </goals>
                    <configuration>
                        <shadedGroupFilter>org.apache.cxf</shadedGroupFilter>
                        <shadedArtifactAttached>false</shadedArtifactAttached>
                        <createSourcesJar>true</createSourcesJar>
                        <promoteTransitiveDependencies>true</promoteTransitiveDependencies>
                        <createDependencyReducedPom>true</createDependencyReducedPom>
                        <filters>
                            <filter>
                                <artifact>${project.groupId}:${project.artifactId}</artifact>
                                <excludes>
                                    <exclude>org/**</exclude>
                                </excludes>
                            </filter>
                        </filters>
                        <transformers>
                            <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                <mainClass>org.hive.browser.Main</mainClass>
                            </transformer>
                            <transformer implementation="org.apache.maven.plugins.shade.resource.ApacheNoticeResourceTransformer">
                                <projectName>Apache CXF</projectName>
                            </transformer>
                            <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                                <resource>META-INF/spring.handlers</resource>
                            </transformer>
                            <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                                <resource>META-INF/services/com.sun.tools.xjc.Plugin</resource>
                            </transformer>
                            <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                                <resource>META-INF/spring.schemas</resource>
                            </transformer>
                            <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                                <resource>META-INF/cxf/cxf.extension</resource>
                            </transformer>
                            <transformer implementation="org.apache.maven.plugins.shade.resource.XmlAppendingTransformer">
                                <resource>META-INF/extensions.xml</resource>
                            </transformer>
                            <transformer implementation="org.apache.maven.plugins.shade.resource.XmlAppendingTransformer">
                                <resource>META-INF/cxf/extensions.xml</resource>
                            </transformer>
                            <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                                <resource>META-INF/cxf/bus-extensions.txt</resource>
                            </transformer>
                            <transformer implementation="org.apache.maven.plugins.shade.resource.XmlAppendingTransformer">
                                <resource>META-INF/cxf/bus-extensions.xml</resource>
                            </transformer>
                            <transformer implementation="org.apache.maven.plugins.shade.resource.XmlAppendingTransformer">
                                <resource>META-INF/wsdl.plugin.xml</resource>
                            </transformer>
                            <transformer implementation="org.apache.maven.plugins.shade.resource.XmlAppendingTransformer">
                                <resource>META-INF/tools.service.validator.xml</resource>
                            </transformer>
                            <!--<transformer implementation="org.apache.cxf.maven.PluginTransformer">-->
                            <!--<resource>META-INF/tools-plugin.xml</resource>-->
                            <!--</transformer>-->
                            <transformer implementation="org.apache.maven.plugins.shade.resource.XmlAppendingTransformer">
                                <resource>META-INF/cxf/java2wsbeans.xml</resource>
                            </transformer>
                            <!--<transformer implementation="org.apache.cxf.maven.CXFAllTransformer"/>-->
                        </transformers>
                    </configuration>
                </execution>
            </executions>
        </plugin>

我正在使用 MacOSX 10.6 和 Java 1.6 怎么了?

4

1 回答 1

2

<scope>system</scope>打破依赖机制。

如果您无法在您可以访问的存储库中找到它,我建议您在自己的存储库中安装您拥有的 jar 并删除范围标记。

于 2013-09-16T16:45:52.457 回答