How to manage external jar with Alfresco SDK 3

cancel
Showing results for 
Search instead for 
Did you mean: 
bcassand
Member II

How to manage external jar with Alfresco SDK 3

Jump to solution

Hi,

I'm using Alfresco SDK 3 with Alfresco 5.2, for extending the Alfresco platform, using maven and the AllInOne archetype.

What I don't manage to see are how are managed the external jar for the platform.

The extension is splitted in several jars that are used by the platform project, using <dependency> in maven (at platform project level). It builds fine, the platform jar is generated, but when deployed using maven and alfresco:run, I don't manage to see where are all my jars that the platform depends on. And obviously tomcat does not find them. In the WEBINF I have the platform jar, but none of the additional jars.

For information the build also generates an amp file for the platform (even if I'm building a jar module), that includes everything (the platform jar and my additional jars). So the build process seems to see them well. It's more the alfresco maven plugin that does not seem to consider them when deploying.

So how to deal with these external jars, when using the SDK and the alfresco maven plugin?

1 Solution

Accepted Solutions
jeffrosler
Partner

Re: How to manage external jar with Alfresco SDK 3

Jump to solution

Thought I'd respond, even though this is an older post. If you use jar deployment in SDK 3.0 and you have external dependencies (e.g. another jar that you pull from maven that includes classes you're using in your customization), you have to deploy that jar separately yourself. If you choose amp deployment, then it will include the external jar for you. If you are running locally with H2 (e.g. using run.sh script) and you want that to work correctly, make sure you add your dependency not only under <dependencies> but as a <moduleDependency> in the alfresco-maven-plugin. You can see where to add them if you search for the comment 

<!-- Bring in custom Modules -->.

View solution in original post

2 Replies
jeffrosler
Partner

Re: How to manage external jar with Alfresco SDK 3

Jump to solution

Thought I'd respond, even though this is an older post. If you use jar deployment in SDK 3.0 and you have external dependencies (e.g. another jar that you pull from maven that includes classes you're using in your customization), you have to deploy that jar separately yourself. If you choose amp deployment, then it will include the external jar for you. If you are running locally with H2 (e.g. using run.sh script) and you want that to work correctly, make sure you add your dependency not only under <dependencies> but as a <moduleDependency> in the alfresco-maven-plugin. You can see where to add them if you search for the comment 

<!-- Bring in custom Modules -->.

bcassand
Member II

Re: How to manage external jar with Alfresco SDK 3

Jump to solution

Thanks for the detailed answer ^^

In fact I took a wrong path trying to use jar deployment, due to documentation of Alfresco 5.2 that was considering AMP as almost obsolete and jar the way to go. But in more recent version (Alfresco 6) it's clearly stated that with external dependencies it should be deployed as AMP. It does not seem to be considered so obsolete anymore.

So as the SDK generates both (Jar and AMP), AMP seems a clean way to proceed.