【问题标题】:OSGI example fails when maven-bundle-plugin deploys itOSGI 示例在 maven-bundle-plugin 部署时失败
【发布时间】:2014-05-26 03:56:12
【问题描述】:

我正在研究“OSGi 和 Apache Felix 3.0”一书中的一个示例。在 Maven 部署阶段,它失败并显示以下消息:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project bookshelf-inventory-api: 
Execution default-deploy of goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy failed: 
Plugin org.apache.maven.plugins:maven-deploy-plugin:2.7 or one of its dependencies could not be resolved: 
The repository system is offline but the artifact org.codehaus.plexus:plexus-utils:jar:1.5.6 is not available in the local repository.

这告诉我什么,是否有解决方法?

这是我的 pom.xml:

<groupId>osgi.example</groupId>
  <artifactId>bookshelf-inventory-api</artifactId>
  <version>1.0.0</version>

  <packaging>bundle</packaging>

  <dependencies>
    <dependency>
      <groupId>org.apache.felix</groupId>
      <artifactId>maven-bundle-plugin</artifactId>
      <version>2.4.0</version>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <inherited>true</inherited>
        <configuration>
          <source>1.7</source>
          <target>1.7</target>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <version>2.4.0</version>
        <extensions>true</extensions>
        <configuration>
          <instructions>
            <Bundle-Category>inventory</Bundle-Category>
            <Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
            <Export-Package>osgi.example.bookshelf.inventory.api</Export-Package>
          </instructions>
          <remoteOBR>repo-rel</remoteOBR>
          <prefixUrl>file:///C:/home/src/demo/osgi/felix-3-book/releases</prefixUrl>
          <ignoreLock>true</ignoreLock>
          <!--
          <instructions>
            <Private-Package>org.foo.myproject.*</Private-Package>
            <Bundle-Activator>org.foo.myproject.impl1.Activator</Bundle-Activator>
          </instructions>
          -->
        </configuration>
      </plugin>
    </plugins>
  </build>
  <distributionManagement>
    <!-- releases repo -->
    <repository>
      <id>repo-rel</id>
      <url>file:///C:/home/src/demo/osgi/felix-3-book/releases</url>
    </repository>
  </distributionManagement>
   <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

【问题讨论】:

    标签: maven osgi apache-felix maven-bundle-plugin


    【解决方案1】:

    消息是说您正在尝试以离线模式 (-o) 构建并且找不到依赖项:org.codehaus.plexus:plexus-utils:jar:1.5.6

    如果不是这种情况并且您在线收到此消息,请尝试删除 ~/.m2/org/codehaus/plexus 并重试。可能文件下载时出错。

    【讨论】:

    • 当我尝试从企业防火墙外部构建时,这个问题就消失了。它现在也从防火墙内部构建。我不知道这是否是问题,因为我无法重现它。我会接受你的回答。
    猜你喜欢
    • 2011-05-21
    • 2011-06-18
    • 2013-02-10
    • 2016-07-20
    • 2017-01-02
    • 2012-04-20
    • 2013-02-28
    • 2012-10-29
    • 1970-01-01
    相关资源
    最近更新 更多