AnsweredAssumed Answered

Maven/AMP difficulties

Question asked by mauricel on Dec 27, 2013
Hi everyone. I'm a .NET dev, so I'm very new to java/maven/alfresco. I'm trying to convert an Alfresco plugin into an AMP structure using Maven (artifactId: alfresco-sdk-parent, version: 1.0.2), and I'm having huge difficulties.

Architecture is as follows: there are two plugins, a repo plugin that generates a hyperlink, and a share plugin that provides additional menu items to DocLibActions in Share. The UI calls web scripts (hosted by the share APM) when then call the repo plugin. The repo plugin works fine.

My understanding is that I need to do the following:

1. Remove my existing UI from share-config-custom.xml, and move it to a separate file.
2. Register that file in service-context.xml somehow.
3. Add client side .css, .js, and images to src/main/amp/web.
4. Add my webscripts somewhere. These webscripts are .js only and are not backed by java, so I *probably* don't need to register these in service-context.xml? I do, however, have to work out where the right place in the maven structure is supposed to be.

Right now, I'm not seeing ANY additional menu items at all. I have looked at share.log, and set "log4j.logger.org.springframework=" to DEBUG. Share.log doesn't appear to show anything that stands out as an error, but then again, I'm not sure what I'm looking for.

Right now, I'm making a tweak, copying an amp file to a virtual machine (c:\alfresco\amps_share), and running "apply-amps.bat". It takes on the order of 5-10 minutes per attempt. I'm getting absolutely no feedback from Alfresco and I have no idea how to debug what I'm doing wrong.

Regarding steps 1-4 – am I doing the right thing here? Also, how do I debug this? Surely there should be some logging that says "I loaded the following AMP, and resolved the following beans…"?

Further details :

For step 1, I extracted the additional ui to a file: src\main\amp\config\alfresco\module\{module-id}\ui\web-client-config-custom.xml.

For step 2, I have experimented with several permutations of the following code to service-context.xml.

<bean id="${project.artifactId}_configBootstrap" class="org.springframework.extensions.config.ConfigBootstrap" init-method="register" depends-on="webframework.configsource">
        <property name="configService" ref="web.config" />
        <property name="configs">
            <list>
                <value>classpath:alfresco/module/${project.artifactId}/ui/web-client-config-custom.xml</value>
            </list>
        </property>
    </bean>


For step 4, I have moved my webscripts xml, ftl and js to:
src\main\amp\config\alfresco\extension\templates\webscripts\

I'm at my wits end with this one, hopefully someone can help. Alfresco looks like a nice product, but working with it during Christmas is absolutely soul destroying.

Maurice.

Outcomes