cancel
Showing results for 
Search instead for 
Did you mean: 

Prefered way to handle AMP dependencies in Maven SDK?

arnoldschrijve1
Champ on-the-rise
Champ on-the-rise
I am in the process of converting our own Alfresco Maven projects to use the Maven SDK and am wondering what is the best way for one AMP to depend on another in a way that Java code also works. The AMP dependency in the POM is not sufficient.
According to Josh Barret in <a href="http://josh-barrett.blogspot.nl/2012/10/amps-vs-jars-for-alfresco-customizations_3605.html">this 2012 blog post</a> this is a major flaw of the AMP design above packaging as JAR. Is this not solved in the Maven SDK, I couldn't find it in the documentation?

What I am now doing to tackle this is use the build-helper-maven-plugin like this:


            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-artifacts</id>
                        <phase>package</phase>
                        <goals>
                            <goal>attach-artifact</goal>
                        </goals>
                        <configuration>
                            <artifacts>
                                <artifact>
                                    <file>${project.build.directory}/${project.artifactId}/lib/${project.artifactId}.jar</file>
                                    <type>jar</type>
                                </artifact>
                            </artifacts>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

1 REPLY 1

vince20151
Champ in-the-making
Champ in-the-making
I am facing the exact problem. I have an AMP that contains common java code and would like to expose it to other dependendent AMP for build.
There is no current way to automatically register the jar file in the common AMP in local Maven repository for other AMP to build. I would need to build the common AMP. Register the jar file in it to local maven as a separate step. Then build the dependent AMP. Is there a way to do set this so it does that automatically in the Maven build file?