无法满足从com.lmax.disruptor 3.2.0到包sun.misc 0.0.0的依赖 [英] unable to satisfy dependency from com.lmax.disruptor 3.2.0 to package sun.misc 0.0.0

查看:190
本文介绍了无法满足从com.lmax.disruptor 3.2.0到包sun.misc 0.0.0的依赖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个需要一个com.lmax.disruptor的eclipse插件,它导入sun.misc。我有这个在我的p2存储库,但是当我maven构建我的插件我得到这个错误无法满足从com.lmax.disruptor 3.2.0包装sun.misc 0.0.0的依赖。



我已经通过网站解决与Tycho的包sun.misc的依赖他们说要创建一个插件片段,但是当我尝试创建它并添加导出页面作为sun.misc,它抛出一个错误,如package sun.misc doesnot在插件中存在。



如何解决这个问题,请帮助我。



谢谢,

解决方案

如您所链接的问题中的 oberlies答案所述,您需要构建一个系统捆绑包片段,它暴露出来,即export, sun.misc 包。我不知道有什么其他的方式。但是,这比预期更容易。



您可以通过创建出口的OSGi MANIFEST.MF 来实现sun.misc,然后将其捆绑成一个片段。这通过Maven完成如下。

 < project xmlns =http:// maven .apache.org / POM / 4.0.0xmlns:xsi =http://www.w3.org/2001/XMLSchema-instancexsi:schemaLocation =http://maven.apache.org/POM/4.0 .0 http://maven.apache.org/maven-v4_0_0.xsd\"> 
< modelVersion> 4.0.0< / modelVersion>
< groupId> your.group< / groupId>
< version> 1.0.0< / version>

< artifactId> your.group.fragment.sun.misc< / artifactId>
< packaging> jar< / packaging>
< name> System Bundle片段导出sun.misc< / name>

< description>此捆绑包使用sun.misc包扩展了System Bundle导出列表,以便OSGi捆绑包可以引用Sun的misc实现,而不用OSGi框架本身以非便携式方式提供< /描述>

< build>
< plugins>
< plugin>
< artifactId> maven-jar-plugin< / artifactId>
< configuration>
< forceCreation> true< / forceCreation>
< archive>
< manifestFile> $ {project.build.outputDirectory} /META-INF/MANIFEST.MF</manifestFile>
< manifestEntries>
< Export-Package> sun.misc< / Export-Package>
< / manifestEntries>
< / archive>
< / configuration>
< / plugin>
< plugin>
< groupId> org.apache.felix< / groupId>
< artifactId> maven-bundle-plugin< / artifactId>
< version> 2.5.4< / version>
<执行>
< execution>
< id> bundle-manifest< / id>
< phase> process-classes< / phase>
< goals>
< goal>清单< / goal>
< / goals>
< / execution>
< / executions>
< configuration>
<指令>
< Bundle-Category> your.group< / Bundle-Category>
< Fragment-Host> system.bundle;扩展:=&框架LT; /片段 - 主机>
< / instructions>
< / configuration>
< / plugin>

< / plugins>
< / build>

< / project>

在此POM上运行 mvn clean install 现在,您需要为Tycho提供片段消耗品,即您需要通过p2软件站点使其可用。



幸运的是,有一个伟大的Maven插件可以帮助其中: reficio的p2-maven-plugin 。您可以使用它来将任何mavenized JAR包装到OSGi包中,然后通过p2站点提供。



如下设置相应的POM。

 < project xmlns =http://maven.apache.org/POM/4.0.0xmlns :xsi =http://www.w3.org/2001/XMLSchema-instancexsi:schemaLocation =http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ XSD /行家-4.0.0.xsd> 
< modelVersion> 4.0.0< / modelVersion>
< groupId> sun-misc-p2< / groupId>
< artifactId> site< / artifactId>
< version> 1.0.0< / version>
< packaging> pom< / packaging>

< build>
< plugins>
< plugin>
< groupId> org.reficio< / groupId>
< artifactId> p2-maven-plugin< / artifactId>
< version> 1.1.1< / version>
<执行>
< execution>
< id> default-cli< / id>
< configuration>
<工件>
<! - 在这里指定您的关系 - >
<! - groupId:artifactId:version - >
< artifact>< id> com.lmax:disruptor:3.3.2< / id>< / artifact>
< artifact>< id> your.group:your.group.fragment.sun.misc:1.0.0< / id>< / artifact>
< / artifacts>
< / configuration>
< / execution>
< / executions>
< / plugin>
< plugin>
< groupId> org.mortbay.jetty< / groupId>
< artifactId> jetty-maven-plugin< / artifactId>
< version> 8.1.5.v20120716< / version>
< configuration>
< scanIntervalSeconds> 10< / scanIntervalSeconds>
< webAppSourceDirectory> $ {basedir} / target / repository /< / webAppSourceDirectory>
< webApp>
< contextPath> / site< / contextPath>
< / webApp>
< / configuration>
< / plugin>
< / plugins>
< / build>
< pluginRepositories>
< pluginRepository>
< id> reficio< / id>
< url> http://repo.reficio.org/maven/< / url>
< / pluginRepository>
< / pluginRepositories>
< / project>

注意,我使用此插件提供LMAX Disruptor(版本3.3 .2,写作时最新的,可以从Maven Central获得)。



运行 mvn p2:site 在POM上。这将在 {project-folder} / target / repository 中创建一个包含 sun.misc 片段的p2网站。 / p>

现在可以将这个p2存储库和它的 sun.misc 片段添加到目标平台,因此在您的Tycho版本中使用。



这应该修复它,并 - 回答你的问题,如果有什么可能的方法[你]可以添加在你的插件本身 - 这是唯一可行的方法(我知道)。



这些来源也可以在 https://github.com/newcodeontheblock/eclipse-rcp-with-async-logging 。整个过程也在 this - my - 关于在Eclipse RCP中使用异步Log4j 2记录器的博客


I am developing an eclipse plugin which needs an com.lmax.disruptor.It imports sun.misc. I have this in my p2 repository but when I maven build my plugin I am getting this error "unable to satisfy dependency from com.lmax.disruptor 3.2.0 to package sun.misc 0.0.0."

I have gone through the sites Resolve a dependency on package sun.misc with Tycho they are saying to create a plugin fragment but when I tried to create it and added export page as sun.misc, It is throwing an error like "package sun.misc doesnot exsist in the plugin".

How can solve this issue please help me with this.? Instead of creating new plugin fragment,is there is any possible way i can add in my plugin itself ?

Thanks,

解决方案

As mentioned in oberlies' answer in the question you link to, you need to build a system bundle fragment, which exposes, i.e., exports, the sun.misc package. I don't know of any other way. However, this is easier than could be expected.

You do this by creating an OSGi MANIFEST.MF that exports sun.misc, and then bundle it into a fragment. This is done via Maven as follows.

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
      <groupId>your.group</groupId>
      <version>1.0.0</version>

    <artifactId>your.group.fragment.sun.misc</artifactId>
    <packaging>jar</packaging>
    <name>System Bundle Fragment exporting sun.misc</name>

    <description>This bundle extends the System Bundle export list with the sun.misc package such that OSGi bundles may refer to Sun's misc implementation without the OSGi framework itself to provide it in a non-portable way.</description>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <forceCreation>true</forceCreation>
                    <archive>
                        <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
                        <manifestEntries>
                            <Export-Package>sun.misc</Export-Package>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>2.5.4</version>
                <executions>
                    <execution>
                        <id>bundle-manifest</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>manifest</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <instructions>
                        <Bundle-Category>your.group</Bundle-Category>
                        <Fragment-Host>system.bundle; extension:=framework</Fragment-Host>
                    </instructions>
                </configuration>
            </plugin>

        </plugins>
    </build>

</project>

Run mvn clean install on this POM. Now you need to make the fragment consumable for Tycho, i.e., you need to make it available via a p2 Software Site.

Thankfully there is a great Maven plugin which can help with that: reficio's p2-maven-plugin. You can use it to basically wrap any mavenized JAR into an OSGi bundle and then provide it via a p2 site.

Set up the respective POM as follows.

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>sun-misc-p2</groupId>
  <artifactId>site</artifactId>
  <version>1.0.0</version>
  <packaging>pom</packaging>

  <build>
            <plugins>
                <plugin>
                    <groupId>org.reficio</groupId>
                    <artifactId>p2-maven-plugin</artifactId>
                    <version>1.1.1</version>
                    <executions>
                        <execution>
                            <id>default-cli</id>
                            <configuration>
                                <artifacts>
                                    <!-- specify your depencies here -->
                                    <!-- groupId:artifactId:version -->
                                    <artifact><id>com.lmax:disruptor:3.3.2</id></artifact>
                                    <artifact><id>your.group:your.group.fragment.sun.misc:1.0.0</id></artifact>
                                </artifacts>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.mortbay.jetty</groupId>
                    <artifactId>jetty-maven-plugin</artifactId>
                    <version>8.1.5.v20120716</version>
                    <configuration>
                        <scanIntervalSeconds>10</scanIntervalSeconds>
                        <webAppSourceDirectory>${basedir}/target/repository/</webAppSourceDirectory>
                        <webApp>
                            <contextPath>/site</contextPath>
                        </webApp>
                   </configuration>
                </plugin>
            </plugins>
        </build>
        <pluginRepositories>
            <pluginRepository>
                <id>reficio</id>
                <url>http://repo.reficio.org/maven/</url>
            </pluginRepository>
        </pluginRepositories> 
</project>

Note that I use this plugin to provide the LMAX Disruptor (version 3.3.2, the latest one at the time of writing, is thankfully available from Maven Central).

Run mvn p2:site on the POM. This will create a p2 site containing the sun.misc fragment at {project-folder}/target/repository.

This p2 repository - and with it the sun.misc fragment - can now be added to your target platform, and hence used in your Tycho build.

This should fix it, and - to answer your question if "there is any possible way [you] can add in [your] plugin itself" - this is the only possible way to do it (I know of).

The sources are also available at https://github.com/newcodeontheblock/eclipse-rcp-with-async-logging. The whole procedure is also described in more detail in this - my - blog post about using async Log4j 2 loggers in an Eclipse RCP.

这篇关于无法满足从com.lmax.disruptor 3.2.0到包sun.misc 0.0.0的依赖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆