嵌入式错误:无法传输文件:http:// localhost:4502 / apps / myProject-core.jar。返回码是:401

时间:2014-02-07 13:46:23

标签: maven cq5 osgi-bundle crx

我使用以下配置文件将我的osgi包部署到CQ5 / crx:

 <id>deployToAuthor</id>
 <activation>
    <activeByDefault>false</activeByDefault>
 </activation>
 <build>
    <plugins>

       <plugin>

          <artifactId>maven-antrun-plugin</artifactId>
          <executions>
             <execution>
                <id>echo Deployment auf Authoren-Instanz, myProject</id>
                <phase>install</phase>
                <configuration>
                   <tasks>
                      <echo
                         message="Deployment auf Instanz AUTHOR ! (${install.host}:${install.port}), myProject!"/>
                   </tasks>
                </configuration>
                <goals>
                   <goal>run</goal>
                </goals>
             </execution>
          </executions>
       </plugin>
       <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>wagon-maven-plugin</artifactId>
          <version>1.0-beta-3</version>
          <executions>
             <execution>
                <id>upload-felix-bundle-author</id>
                <phase>install</phase>
                <goals>
                   <goal>upload</goal>
                </goals>
                <configuration>
                   <fromDir>${project.build.directory}</fromDir>
                   <includes>*.jar</includes>
                   <excludes>pom.xml</excludes>
                   <serverId>${install.host}</serverId>
                   <url>dav:${webdav.protocol}://${install.host}:${install.port}</url>
                   <toDir>apps/${portal.name}/install</toDir>
                </configuration>
             </execution>
          </executions>
       </plugin>
    </plugins>
 </build>

我收到以下错误:

[INFO] Tests are skipped.
[INFO] [bundle:bundle {execution: default-bundle}]
[WARNING] Bundle path.myProject:myProject-core:bundle:1.5.18-SNAPSHOT : Export path.myProject.components.alerts,  has 1,  private references [au.com.bytecode.opencsv], 
[WARNING] Bundle path.myProject:myProject-core:bundle:1.5.18-SNAPSHOT : Export path.myProject.unionhtmlimport,  has 1,  private references [path.myProject.unionhtmlimport.impl], 
[INFO] [resources:copy-resources {execution: copy-resources}]
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] [install:install {execution: default-install}]
[INFO] Installing C:\path\myProject\myProject-core\target\myProject-core.jar to C:\path\.m2\repository\path\myProject\myProject-core\1.5.18-SNAPSHOT\myProject-core-1.5.18-SNAPSHOT.jar
[INFO] [bundle:install {execution: default-install}]
[INFO] Installing path/myProject/myProject-core/1.5.18-SNAPSHOT/myProject-core-1.5.18-SNAPSHOT.jar
[INFO] Writing OBR metadata
[INFO] [antrun:run {execution: echo Deployment auf Authoren-Instanz, myProject}]
[INFO] Executing tasks
     [echo] Deployment auf Instanz AUTHOR ! (localhost:4502), Project myProject!
[INFO] Executed tasks
[INFO] [wagon:upload {execution: upload-felix-bundle-author}]
[INFO] Uploading C:\path\myProject\myProject-core\target\myProject-core.jar to http://localhost:4502/apps/myProject/install/myProject-core.jar ...
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error handling resource

Embedded error: Failed to transfer file: http://localhost:4502/apps/myProject/install/myProject-core.jar. Return code is: 401

1 个答案:

答案 0 :(得分:0)

似乎相当复杂。为什么不使用Maven Sling plugin

<project>
  <properties>
    <sling.url>http://localhost:4502</sling.url>
    <sling.username>admin</sling.username>
    <sling.password>admin</sling.password>
  </properties>
  ...
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.sling</groupId>
        <artifactId>maven-sling-plugin</artifactId>
        <version>2.1.0</version>
        <configuration>
          <bundleFileName>${project.build.directory}/${project.build.finalName}.jar</bundleFileName>
          <user>${sling.username}</user>
          <password>${sling.password}</password>
          <slingUrl>${sling.url}/system/console</slingUrl>
        </configuration>
      </plugin>
      ...

用法:

mvn clean package sling:install

另外,请使用此插件查看示例项目:Sling-Query