Re: Append behavior to "build" action

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Append behavior to "build" action

Javier Ortiz

First this should be on the [hidden email] list.

 

I use the following:

 

<property name="original.project.dir" value="../Path/to/desired/project"/>

 

    <target name="netbeans" depends="-define-ant-contrib-tasks ">

        <if>

            <isset property="original.project.dir"/>

            <then>

                <property file="${original.project.dir}/nbproject/project.properties" prefix="extension-lib"/>

                <length string="${extension-lib.dist.dir}" property="length.dist" />

                <math result="length.dist" operand1="1" operation="+" operand2="${length.dist}" datatype="int"/>

                <length string="${extension-lib.dist.jar}" property="length.dist.jar" />

                <substring text="${extension-lib.dist.jar}" start="${length.dist}" end="${length.dist.jar}" property="extension-lib.dist.jar" />

                <!--Update the module's property file-->

                <propertyfile file="nbproject/project.properties">

                    <entry key="extra.module.files" value="modules/ext/${extension-lib.dist.jar}"/>

                </propertyfile>

                <!--Update the project's metadata-->

                <xmltask source="nbproject/project.xml" dest="nbproject/project.xml">

                    <replace path="/project/configuration/data[1]/class-path-extension/runtime-relative-path/text()"

                             withText="ext/${extension-lib.dist.jar}"/>

                    <replace path="/project/configuration/data[1]/class-path-extension/binary-origin/text()"

                             withText="${original.project.dir}/dist/${extension-lib.dist.jar}"/>

                </xmltask>

                <property name="original.project.jar"

                          value="${original.project.dir}/dist/${extension-lib.dist.jar}"/>

                <echo message="Building ${original.project.dir}"/>

                <ant dir="${original.project.dir}" usenativebasedir="true"

                     target="jar" inheritall="false" inheritrefs="false"/>

                <echo message="Done building ${original.project.dir}"/>

                <copy todir="../build/cluster/modules/ext" file="${original.project.jar}"/>

            </then>

        </if>

        <antcall target="projectized-common.netbeans"/>

    </target>

 

    <target name="clean" depends="projectized-common.clean, -define-ant-contrib-tasks ">

        <if>

            <isset property="original.project.dir"/>

            <then>

                <echo message="Cleaning ${original.project.dir}"/>

                <ant dir="${original.project.dir}" usenativebasedir="true"

                     target="clean" inheritall="false" inheritrefs="false"/>

                <echo message="Done cleaning ${original.project.dir}"/>

            </then>

        </if>

    </target>

 

The script above compiles the target Java project, gets it into the proper place of the RCP app compilation process and updates key files with the proper values (in case the java project changes output jar name for example. Make sure to add this to the project.xml file of the NB module:

 

<class-path-extension>

                <runtime-relative-path>ext/x.jar</runtime-relative-path>

                <binary-origin>../Path/to/desired/project /dist/x.jar</binary-origin>

            </class-path-extension>

 

The script will change x.jar with the proper name. The script assumes there’s only one entry like the above.

 

Feel free to make any question you have about it.

 

 

Senior Software Quality Engineer

ArthroCare Corporation

7000 William Cannon Drive

Austin, TX 78735

Phone: 512-358-5996

email: [hidden email]

 

From: Marcelo Schneider [mailto:[hidden email]]
Sent: Tuesday, February 21, 2012 8:13 AM
To: [hidden email]
Subject: [nbusers] Append behavior to "build" action

 

 

Hello all,

 

I’m working on a netbeans platform/maven application, that requires a custom .jar to be on its /platform/core folder when its run.

We use IzPack to create the installer, so it’s easy to copy the .jar to its destination when the app is installed.

 

However, on the development environment, how can I copy the required .jar file to the /target/myApp/platform/core folder every time the “Build”, “Clean and build” of “Build with Dependencies” action is executed in NetBeans?

 

I’ve completely no idea of where to start or what to do, so any pointers to reading material are greatly appreciated.

 

 

 

Marcelo Frantz Schneider
Marine Cybernetics
Vestre Rosten 77, Trondheim, Norway
marcelo.schneider (at) marinecyb.com

 

**********

The information contained in this e-mail message, together with any
attachments thereto, is intended only for the personal and confidential
use of the addressee named above. The message and the attachments
are or may be privileged or protected communication. If you are not the
intended recipient of this message, or authorized to receive it for the
intended recipient, you have received this message in error, and you
are not to review, use, disseminate, distribute or copy this message,
any attachments thereto, or their contents. If you have received this
message in error, please immediately notify us by return e-mail
message, and delete the original message.

Pursuant to Circular 230 issued by the United States Treasury
Department and relating to practice before the Internal Revenue
Services, any comment or opinion in this communication relating to a
federal tax issue is not intended to be used, and cannot be used, by a
taxpayer for the purpose of avoiding tax-related penalties that may be
imposed on the taxpayer.
Loading...