AnsweredAssumed Answered

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

Question asked by santa on Nov 30, 2013
Latest reply on Dec 7, 2013 by santa
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

Outcomes