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

Maven 嵌入错误:无法传输文件:http://localhost:4502/apps/myProject-core.jar。返回代码是:401,maven,aem,osgi-bundle,crx,Maven,Aem,Osgi Bundle,Crx,我使用以下配置文件将我的osgi捆绑包部署到CQ5/crx: <id>deployToAuthor</id> <activation> <activeByDefault>false</activeByDefault> </activation> <build> <plugins> <plugin> <artifactId&

我使用以下配置文件将我的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]将Bundle path.myProject.core(C:\path\myProject core\target\myProject core.jar)安装到via PUT[error]安装失败,原因:找不到[INFO]--------------------------[INFO]生成成功请更新插件配置中的
bundleFileName
属性以反映包的本地化。使用“bundleFileName”的本地化是正确的。我只是将长路径名替换为单词“path”,我不知道如何在这里调试您的问题。在我的答案中添加了示例工作项目,您可以将其用作模板。
[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
<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