cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible Ant to Maven 3.x conversion for Alfresco 2.1.0 version WAR generation

santa
Champ in-the-making
Champ in-the-making
Currently iam doing alfresco .amp  and my app war generation through ant build , i have to migrate the app from ant buil.xml to maven 3x based build.
Alfresco version is : 2.1.0R1

Here is my ant buil.d .xml

<?xml version="1.0"?>

<project name="ASP AMP Build File" default="package-amp" basedir=".">

   <property name="project.dir" value="."/>
   <property name="alfresco.dir" value="C:/Tools/Dev/AlfrescoExtention/alfresco-community-sdk-2.1.0R1"/>
   <property name="build.dir" value="${project.dir}/build"/>
   <property name="config.dir" value="${project.dir}/config"/>
   <property name="jar.file" value="${build.dir}/lib/alfresco-asp.jar"/>
   <property name="amp.file" value="${build.dir}/dist/alfresco-asp.amp"/>

    <target name="mkdirs">
        <mkdir dir="${build.dir}/dist" />
        <mkdir dir="${build.dir}/lib" />
    </target>

    <path id="class.path">
        <dirset dir="${build.dir}" />
        <fileset dir="${alfresco.dir}/lib" includes="**/*.jar"/>
       <fileset dir="${project.dir}/lib" includes="**/*.jar"/>
    </path>

    <target name="compile" >
        <javac debug="on" classpathref="class.path" srcdir="${project.dir}/source/java" destdir="${build.dir}/classes" />
    </target>

    <target name="package-jar" depends="compile">
        <jar destfile="${jar.file}" >
            <fileset dir="${build.dir}/classes" excludes="**/custom*,**/*Test*" includes="**/*.class" />
        </jar>
    </target>

    <target name="package-amp" depends="mkdirs, package-jar" description="Package the Module" >
        <echo>Packaging up AMP ${amp.file}</echo>
        <zip destfile="${amp.file}" >
            <fileset dir="${project.dir}/source/" includes="web/**/*.*" />
           <fileset dir="${project.dir}/source/" includes="web/**/**/*.*" />
           <fileset dir="${project.dir}/" includes="WEB-INF/faces-config-custom.xml" />
           <fileset dir="${project.dir}/" includes="WEB-INF/repo.tld" />
           <fileset dir="${project.dir}/" includes="index.jsp" />
           <fileset dir="${project.dir}/" includes="WEB-INF/web.xml" />
           <fileset dir="${project.dir}/" includes="file-mapping.properties" />
           <fileset dir="${project.dir}/" includes="lib/*.jar" />
            <fileset dir="${project.dir}/build" includes="lib/*.jar" />
            <fileset dir="${project.dir}" includes="config/**/*.*" excludes="**/module.properties,**/asp-repository.properties,**/asp-config.xml" />
            <fileset dir="${project.dir}/config/alfresco/module/ASP amp" includes="module.properties" />
        </zip>
    </target>

    <target name="update-war" depends="package-amp" description="Update the WAR file.  Set -Dwar.file=…" >
        <echo>Installing asp AMP into WAR ${war.file}</echo>
        <java dir="." fork="true" classname="org.alfresco.repo.module.tool.ModuleManagementTool">
            <classpath refid="class.path" />
            <arg line="install ${amp.file} ${war.file} -force -review -verbose -nobackup -nocopy "/>
        </java>
    </target>
</project>



Pls  help me how to migrate from ant to maven 3x build. Thanks in advance
2 REPLIES 2

afaust
Legendary Innovator
Legendary Innovator
Hello,

in order to migrate to a Maven build you would need to re-create POMs for all the Alfresco libraries (core, data-model, repository …) with the correct dependencies of that Alfresco version and provide these POMs along with the libraries (and sources) in an artifact repository that Maven can access (i.e. Sonatype Nexus).
The toughest part will be re-creating the POMs properly as Alfresco includes a lot of open source libraries, some of which may not even be available in the Maven ecosystem themselves and potentially may no longer be available in the version that Alfresco included in 2.x

As long as you do not upgrade to a more recent Alfresco version and reuse the environment provided by Alfresco, you have your work cut out for you.

Regards
Axel

santa
Champ in-the-making
Champ in-the-making
Thankz