0

I use the following profile to deploy my osgi bundle to 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>

I get the following Error:

[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
Max_Salah
  • 2,407
  • 11
  • 39
  • 68

1 Answers1

0

Seems to be quite complicated. Why not to use 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>
      ...

Usage:

mvn clean package sling:install

Also, please take a look on a sample project using this plugin: Sling-Query.

Tomek Rękawek
  • 9,204
  • 2
  • 27
  • 43
  • I tried this and got the following error: [INFO] Installing Bundle path.myProject.core(C:\path\myProject-core\target\myProject-core.jar) to http://localhost:4502/system/console via PUT [ERROR] Installation failed, cause: Not Found [INFO] -----------------------[INFO] BUILD SUCCESSFUL – Max_Salah Feb 07 '14 at 16:08
  • Please update `bundleFileName` property in the plugin configuration to reflect your package localization. – Tomek Rękawek Feb 07 '14 at 17:03
  • the localization with ´bundleFileName´ is correct. I just replaced the long path name with the word ´path´ – Max_Salah Feb 08 '14 at 15:19
  • I don't know how to debug your problem here. Added sample working project to my answer, you may use it as a template. – Tomek Rękawek Feb 08 '14 at 16:45