Apply AMP Dependency question

498 views
Skip to first unread message

billerby

unread,
Jan 31, 2013, 11:03:03 AM1/31/13
to maven-a...@googlegroups.com
I created an instance of the Allinone archetype today. My intention is to migrate some older maven alfresco builds to this shiny new Maven Alfresco SDK. Everything went smoth att first launch. However now I am trying tom migrate a component we made which consist of a share-jar and a repository-amp to the new amp archetype. I found a the alfresco-visualization-tools hackaton project from Berlin on github (https://github.com/bhagyas/alfresco-visualization-tools) which pretty much matched how I want to package my component (with a parent pom and two submodules repo-amp and share-amp). 

Since both Mau and Gab seems to have been contributing to this project I figure you can instruct me how to add the dependency to my allinone project to include the Alfresco-visualization-tools as a dependency. I tried the following to begin with which failed:

In the allinone/alfresco/pom.xml I added the following dependency:

        <dependency>
            <groupId>org.alfresco.hackathon</groupId>
            <artifactId>repository-amp</artifactId>
            <version>1.0-SNAPSHOT</version>
            <type>amp</type>
        </dependency> 

and an overlay further down:

                        <overlay>
                             <groupId>org.alfresco.hackathon</groupId>
            <artifactId>repository-amp</artifactId>
                            <type>amp</type>
                        </overlay> 

(between amp and alfresco-wcm-quickstart).

Running mvn clean package gives me the following error:

[INFO] Reactor Summary:
[INFO]
[INFO] Quickstart of Alfresco and Share with DB and runner embedded  SUCCESS [0.260s]
[INFO] Alfresco AMP Module ............................... SUCCESS [2.006s]
[INFO] Alfresco Repository and Explorer Client ........... FAILURE [31.731s]
[INFO] Alfresco Apache Solr customization ................ SKIPPED
[INFO] Alfresco Share Client ............................. SKIPPED
[INFO] Alfresco Web Quick Start customization ............ SKIPPED
[INFO] Alfresco and Share Runner ......................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 34.751s
[INFO] Finished at: Thu Jan 31 16:59:10 CET 2013
[INFO] Final Memory: 38M/482M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war (default-war) on project alfresco: Error unpacking file [c:\Maven3Repo\org\alfresco\hackathon\repository-amp\1.0-SNAPSHOT\repository-amp-1.0-SNAPSHOT.amp]to [C:\projekt\projektplatsen\alfresco\target\war\work\org.alfresco.hackathon\repository-amp]: Error while expanding c:\Maven3Repo\org\alfresco\hackathon\repository-amp\1.0-SNAPSHOT\repository-amp-1.0-SNAPSHOT.amp: Problems while installing c:\Maven3Repo\org\alfresco\hackathon\repository-amp\1.0-SNAPSHOT\repository-amp-1.0-SNAPSHOT.amp onto C:\projekt\projektplatsen\alfresco\target\alfresco: 00310000 An IO error was encountered during deployment of the AMP into the WAR: C:\projekt\projektplatsen\alfresco\target\alfresco\WEB-INF\classes\alfresco\module\backup\26aaa7db-6bbf-11e2-af5c-0df2b9c38954.bin -> [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]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :alfresco
/cygdrive/c/projekt/projektplatsen
$

Regards!
/Erik

Maurizio Pillitu

unread,
Jan 31, 2013, 11:21:02 AM1/31/13
to maven-a...@googlegroups.com
Hi Erik,

thanks for sharing this experience with the list; I think you described your intentions pretty clearly and I see that the issue you're having is the same one discussed days ago on this list.

I think that the issue is triggered by the ModuleManagementTool.install() when trying to install your AMP into the alfresco (in this case repository) exploded WAR folder.

I would first suggest you to reproduce it into the repository-amp project, by explicitly invoking the -Pamp-to-war :

cd repository-amp
mvn clean package -Pamp-to-war -X

In theory, this command should reproduce the same issue; if so, it means that your AMP structure is somehow wrong. In my experience, I faced your same issue twice:
  1. I was trying to overwrite some web components using the same path (i.e src/main/amp/web/components) 
  2. I did not have any content in the folder src/main/amp/config/alfresco/module/repository-amp and the folder was not eventually copied into the war
Hope this help, please keep us posted!

mau




--
You received this message because you are subscribed to the Google Groups "Maven Alfresco Lifecycle Discussion Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to maven-alfresc...@googlegroups.com.
To post to this group, send email to maven-a...@googlegroups.com.
Visit this group at http://groups.google.com/group/maven-alfresco?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Maurizio Pillitu
Technical Consultant
Mobile: +31615655668
Skype: m.pillitu

Erik Billerby

unread,
Feb 1, 2013, 3:14:37 AM2/1/13
to maven-a...@googlegroups.com
Hi again,

thanks for your quick reply. I have now tried what you suggested and the outcome was not the expected; running the amp-to-war in the amp-project was successful.

My problem is very easy to reproduce:

1. Create an allinone archetype project. (alfresco-allinone-archetype, number 9)
2. Create an amp archetype project (alfresco-amp-archetype, number 8) and place this somewhere else (ie not inside the allinone project)
3. In the allinone/alfreso/pom.xml add the dependency to you new amp project (number 2), I'm posting the entire pom.xml at the bottom of this message for you to validate.
4. Running mvn clean install first in the amp-project, then in allinone produces the following output with the debug flag set:

Any help greatly appreciated.

Thanks
/Erik

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war (default-war) on project alfresco: Error unpacking file [c:\Maven3Repo\com\billerby\alfresco\testamp\1.0-SNAPSHOT\testamp-1.0-SNAPSHOT.amp]to [C:\projekt\testAllInOne\alfresco\target\war\work\com.billerby.alfresco\testamp]: Error while expanding c:\Maven3Repo\com\billerby\alfresco\testamp\1.0-SNAPSHOT\testamp-1.0-SNAPSHOT.amp: Problems while installing c:\Maven3Repo\com\billerby\alfresco\testamp\1.0-SNAPSHOT\testamp-1.0-SNAPSHOT.amp onto C:\projekt\testAllInOne\alfresco\target\alfresco: 01010000 An IO error was encountered during deployment of the AMP into the WAR: C:\projekt\testAllInOne\alfresco\target\alfresco\WEB-INF\classes\alfresco\module\backup\ae0c7a40-6c46-11e2-bcd4-1fd7cb50abce.bin -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war (default-war) on project alfresco: Error unpacking file [c:\Maven3Repo\com\billerby\alfresco\testamp\1.0-SNAPSHOT\testamp-1.0-SNAPSHOT.amp]to [C:\projekt\testAllInOne\alfresco\target\war\work\com.billerby.alfresco\testamp]
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: Error unpacking file [c:\Maven3Repo\com\billerby\alfresco\testamp\1.0-SNAPSHOT\testamp-1.0-SNAPSHOT.amp]to [C:\projekt\testAllInOne\alfresco\target\war\work\com.billerby.alfresco\testamp]
        at org.apache.maven.plugin.war.packaging.AbstractWarPackagingTask.doUnpack(AbstractWarPackagingTask.java:256)
        at org.apache.maven.plugin.war.packaging.OverlayPackagingTask.unpackOverlay(OverlayPackagingTask.java:122)
        at org.apache.maven.plugin.war.packaging.OverlayPackagingTask.performPackaging(OverlayPackagingTask.java:73)
        at org.apache.maven.plugin.war.AbstractWarMojo.buildWebapp(AbstractWarMojo.java:472)
        at org.apache.maven.plugin.war.AbstractWarMojo.buildExplodedWebapp(AbstractWarMojo.java:404)
        at org.apache.maven.plugin.war.WarMojo.performPackaging(WarMojo.java:215)
        at org.apache.maven.plugin.war.WarMojo.execute(WarMojo.java:177)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
        ... 19 more
Caused by: org.codehaus.plexus.archiver.ArchiverException: Error while expanding c:\Maven3Repo\com\billerby\alfresco\testamp\1.0-SNAPSHOT\testamp-1.0-SNAPSHOT.amp
        at org.alfresco.maven.plugin.archiver.AmpUnArchiver.execute(AmpUnArchiver.java:66)
        at org.codehaus.plexus.archiver.AbstractUnArchiver.extract(AbstractUnArchiver.java:119)
        at org.apache.maven.plugin.war.packaging.AbstractWarPackagingTask.doUnpack(AbstractWarPackagingTask.java:252)
        ... 27 more
Caused by: org.apache.maven.plugin.MojoExecutionException: Problems while installing c:\Maven3Repo\com\billerby\alfresco\testamp\1.0-SNAPSHOT\testamp-1.0-SNAPSHOT.amp onto C:\projekt\testAllInOne\alfresco\target\alfresco
        at org.alfresco.maven.plugin.archiver.AmpUnArchiver.execute(AmpUnArchiver.java:61)
        ... 29 more
Caused by: org.alfresco.repo.module.tool.ModuleManagementToolException: 01010000 An IO error was encountered during deployment of the AMP into the WAR
        at org.alfresco.repo.module.tool.ModuleManagementTool.installModule(ModuleManagementTool.java:283)
        at org.alfresco.maven.plugin.archiver.AmpUnArchiver.execute(AmpUnArchiver.java:54)
        ... 29 more
Caused by: java.nio.file.NoSuchFileException: C:\projekt\testAllInOne\alfresco\target\alfresco\WEB-INF\classes\alfresco\module\backup\ae0c7a40-6c46-11e2-bcd4-1fd7cb50abce.bin
        at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:79)
        at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
        at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)
        at sun.nio.fs.WindowsFileSystemProvider.newByteChannel(WindowsFileSystemProvider.java:229)
        at java.nio.file.spi.FileSystemProvider.newOutputStream(FileSystemProvider.java:430)
        at java.nio.file.Files.newOutputStream(Files.java:170)
        at de.schlichtherle.truezip.fs.nio.file.FileOutputSocket$1OutputStream.<init>(FileOutputSocket.java:219)
        at de.schlichtherle.truezip.fs.nio.file.FileOutputSocket.newOutputStream(FileOutputSocket.java:234)
        at de.schlichtherle.truezip.socket.IOSocket.copy(IOSocket.java:107)
        at de.schlichtherle.truezip.file.TBIO.cp0(TBIO.java:221)
        at de.schlichtherle.truezip.file.TBIO.cp_r0(TBIO.java:179)
        at de.schlichtherle.truezip.file.TBIO.cp_r(TBIO.java:138)
        at de.schlichtherle.truezip.file.TFile.cp_rp(TFile.java:3211)
        at org.alfresco.repo.module.tool.ModuleManagementTool.calculateCopyToWar(ModuleManagementTool.java:580)
        at org.alfresco.repo.module.tool.ModuleManagementTool.calculateChanges(ModuleManagementTool.java:373)
        at org.alfresco.repo.module.tool.ModuleManagementTool.installModule(ModuleManagementTool.java:248)
        ... 30 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :alfresco
/cygdrive/c/projekt/testAllInOne
$




<?xml version="1.0" encoding="UTF-8"?>
<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
    license agreements. See the NOTICE file distributed with this work for additional
    information regarding copyright ownership. The ASF licenses this file to
    You under the Apache License, Version 2.0 (the "License"); you may not use
    this file except in compliance with the License. You may obtain a copy of
    the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
    by applicable law or agreed to in writing, software distributed under the
    License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
    OF ANY KIND, either express or implied. See the License for the specific
    language governing permissions and limitations under the License. -->

    <modelVersion>4.0.0</modelVersion>
    <artifactId>alfresco</artifactId>
    <name>Alfresco Repository and Explorer Client</name>
    <packaging>war</packaging>
    <description>Alfresco Repository and Explorer Client</description>

    <parent>
        <groupId>com.billerby.alfresco</groupId>
        <artifactId>testAllInOne</artifactId>
        <version>1.0-SNAPSHOT</version>
    </parent>

    <dependencies>
        <dependency>
            <groupId>${alfresco.groupId}</groupId>
            <artifactId>alfresco</artifactId>
            <type>war</type>
        </dependency>
        <!-- Demonstrating the dependency on the AMP developed in the 'amp' project -->
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>amp</artifactId>
            <version>${project.version}</version>
            <type>amp</type>
        </dependency>
        <!-- Demonstrating the usage of a well known GA AMP (Web Quick Start Repository component) -->
        <dependency>
            <groupId>${alfresco.groupId}</groupId>
            <artifactId>alfresco-wcm-quickstart-repo</artifactId>
            <version>${alfresco.version}</version>
            <type>amp</type>
        </dependency>
        <dependency>
            <groupId>com.billerby.alfresco</groupId>
            <artifactId>testamp</artifactId>
            <version>1.0-SNAPSHOT</version>
            <type>amp</type>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <configuration>
                    <!--  Here is can control the order of overlay of your (WAR, AMP, etc.) dependencies
                        | NOTE: At least one WAR dependency must be uncompressed first
                        | NOTE: In order to have a dependency effectively added to the WAR you need to
                        | explicitly mention it in the overlay section.
                        | NOTE: First-win resource strategy is used by the WAR plugin
                         -->
                    <overlays>
                        <!-- Current project customizations -->
                        <overlay/>
                        <!-- The Alfresco WAR -->
                        <overlay>
                            <groupId>${alfresco.groupId}</groupId>
                            <artifactId>alfresco</artifactId>
                            <type>war</type>
                            <!-- To allow inclusion of META-INF -->
                            <excludes/>
                        </overlay>
                        <!-- Add / order your AMPs here -->
                        <overlay>
                            <groupId>${project.groupId}</groupId>
                            <artifactId>amp</artifactId>
                            <type>amp</type>
                        </overlay>
                        <overlay>
                            <groupId>${alfresco.groupId}</groupId>
                            <artifactId>alfresco-wcm-quickstart-repo</artifactId>
                            <type>amp</type>
                        </overlay>
                        <overlay>
                             <groupId>com.billerby.alfresco</groupId>
                             <artifactId>testamp</artifactId>
                             <type>amp</type>
                        </overlay>
                    </overlays>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>






Maurizio Pillitu

unread,
Feb 1, 2013, 3:57:24 AM2/1/13
to maven-a...@googlegroups.com
Hi Erik,

I think I figured it out.

First of all, I reproduced your issue locally, following your very same instructions.

The reason of the failure is the second I reported you: "trying to overwrite some web components using the same path (i.e src/main/amp/web/components) "

In your case, what is happening is that:

1. amp module gets overlaid in the WAR; the static resources contained in src/main/amp/web get copied over the WAR
2. the testamp module gets overlaid, tries to copy the same src/main/amp/web resources (demoamp.js and demoamp.css) and - since files already exist - the MMT.install() fails

I fixed the issue by removing the static files from the testamp module:

rm -Rf testamp/src/main/amp/web

Could you try this and let me know? If you can confirm this, we can proceed opening a bug for the MMT module in order to get clearer error messages.

Hope this helps,
mao

Erik Billerby

unread,
Feb 1, 2013, 4:30:40 AM2/1/13
to maven-a...@googlegroups.com
Hi,

I can confirm that this was the issue, please file an issue for the MMT-tool. The error message was really unclear :)

Thank you very much for your help.
/Erik

Maurizio Pillitu

unread,
Feb 1, 2013, 4:50:29 AM2/1/13
to maven-a...@googlegroups.com

Your billerby name is mentioned in the stacktrace; my apologies, if this is an issue for you, I can fix it easily, just let me know.

Glad to help and thank you for always sharing your experiences with us!

mao

Erik Billerby

unread,
Feb 1, 2013, 5:10:21 AM2/1/13
to maven-a...@googlegroups.com
No problem, I'm pretty used to have my name mentioned with stacktraces ;)

/Erik

Erik Billerby

unread,
Feb 1, 2013, 8:37:36 AM2/1/13
to maven-a...@googlegroups.com
Just want to share one more way to get this error.

I had a dependency to joda-time declared without <scope>provided</scope> set in the pom, and since (I guess) the joda-time lib already existed somewhere I got this error.

Regards
/Erik

Maurizio Pillitu

unread,
Feb 1, 2013, 8:53:54 AM2/1/13
to maven-a...@googlegroups.com
Issue[1] updated, thanks!

mao

Reply all
Reply to author
Forward
0 new messages