在Intellij Idea中构建OSGi项目

时间:2014-05-23 05:06:34

标签: maven intellij-idea osgi osgi-bundle

我正在尝试在Intellij Idea中创建一个OSGi maven项目。这是一个简单的计算器。当我尝试构建我的项目时,控制台上会显示以下错误消息。 可能是什么原因?

错误信息如下:

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building cal 1.0.0
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for org.eclipse.osgi:org.eclipse.osgi:jar:3.9.1.v20130814-1242 
is     missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.445s
[INFO] Finished at: Fri May 23 09:22:30 IST 2014
[INFO] Final Memory: 6M/146M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project cal: Could not resolve dependencies 
for    project org.wso2.nilash:cal:jar:1.0.0: Failure to find
org.eclipse.osgi:org.eclipse.osgi:jar:3.9.1.v20130814-1242 in
http://repo.maven.apache.org/maven2 was cached in the local repository,
 resolution will not be reattempted until the update interval of central has elapsed   or     updates are forced -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the     following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN    /DependencyResolutionException

我还在pom.xml中添加依赖项,如下所示:

<dependency>
        <groupId>org.eclipse.osgi</groupId>
        <artifactId>org.eclipse.osgi</artifactId>
        <version>3.9.1.v20130814-1242</version>
    </dependency>

我还添加了不同的版本。但它没有用。

1 个答案:

答案 0 :(得分:2)

控制台输出本身包含一个提示,说明可能导致问题的原因。

来自apache maven documentation on confluence

  

当Maven无法下载时,通常会发生此错误   依赖。导致此错误的可能原因是:

     
      
  1. POM错过了承载工件的声明。
  2.   
  3. 您配置的存储库需要身份验证,Maven无法向服务器提供正确的凭据。在这   大小写,请确保您的${user.home}/.m2/settings.xml包含   <server><id>匹配远程<id>的{​​{1}}声明   要使用的存储库。有关详细信息,请参阅Maven Settings Reference
  4.   
  5. 有问题的远程存储库使用SSL,运行Maven的JVM不信任服务器的证书。
  6.   
  7. 存在阻止Maven访问任何远程存储库的常规网络问题,例如:缺少代理配置。
  8.   
  9. 您已将Maven配置为执行严格的校验和验证,并且要下载的文件已损坏。
  10.   
  11. Maven无法将文件保存到本地存储库,有关详细信息,请参阅LocalRepositoryNotAccessibleException
  12.   

如果JAR的不兼容版本缓存在本地Maven存储库中,也会出现类似问题。在这种情况下,您还应该尝试使用-U命令行参数构建项目(mvn clean install -U应该执行操作)或手动清理本地存储库(在${user.home}/.m2/repository目录中找到然后触发一个构建。