1
votes

In a liferay portlet, the autogenerated build.xml (created with the SDK in eclipse, autogenerated by the wizard) always looks like this

<?xml version="1.0"?>

<project name="my-service-portlet" basedir="." default="deploy">
    <import file="../build-common-portlet.xml" />

</project>

Is it advisable to add custom targets to this? I want to modify the .war file after it is created. Like this: Is there a way with Apache Ant to update a jar file after it's been built?

My war-file is huge because it is autocreated by Liferay's service builder, and it seems to be in need of a few optimizations. I want to remove the WEB-INF/src/.java files (and those WEB-INF/classes/.class files in the .war) that are also in the WEB-INF/lib/.jar. They seem to be duplicated. Can I do this to save space during deployment and to simplify and speed-up the deployment process.

How would such an ant-target look like?

1

1 Answers

4
votes

Sure, that's totally possible:

<project name="MyPortlet" basedir="." default="updateWarAndDeploy">
    <import file="../build-common-portlet.xml" />

    <target name="updateWarAndDeploy">
        <antcall target="war"/>
        -- modify war file --
        <copy file="${plugin.file}" todir="${auto.deploy.dir}" />
    </target>
</project>