You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Robert Nicholson <ro...@elastica.com> on 2001/05/15 22:33:51 UTC

Help with Ant problem...

I've ported the petstore 1.1.2 to weblogic 6.0 and one of the rules I've
created is

an ejbc rule

Do not try to run ejbc at deployment time in Weblogic 6 with petstore.ear it
won't work
as it cannot , at that time, correctly resolve classes across jars. So I
have to run
ejbc before deployment.

now... I'm a little confused as I have the following directory structure

jps1.1.2/src/components/build.xml
jps1.1.2/src/components/customer/src/build.xml

the first build.xml invokes the following rule

<target name="core" depends="init">
    <ant antfile="${tracer.home}/src/build.xml" dir="${tracer.home}/src"
target="core" />
    <ant antfile="${customer.home}/src/build.xml" dir="${customer.home}/src"
target="core" />
    <ant antfile="${personalization.home}/src/build.xml"
dir="${personalization.home}/src" target="core" />
    <ant antfile="${inventory.home}/src/build.xml"
dir="${inventory.home}/src" target="core" />
    <ant antfile="${signon.home}/src/build.xml" dir="${signon.home}/src"
target="core"/>
    <ant antfile="${shoppingcart.home}/src/build.xml"
dir="${shoppingcart.home}/src" target="core" />
    <ant antfile="${mail.home}/src/build.xml" dir="${mail.home}/src"
target="core" />
  </target>

So this runs ant on the customer/src/build.xml rule and it executes
this rule

customerejbjar which looks like this

<target name="customerejbjar" depends="init">
    <property name="customer.buildjardir"
value="${customer.home}/build/ejbjar"/>
    <mkdir dir="${customer.buildjardir}/META-INF"/>
    <copydir src="${customer.classbindir}" dest="${customer.buildjardir}" />
    <copydir src="${util.classbindir}" dest="${customer.buildjardir}" />
    <copyfile src="customer_ejb.xml"
dest="${customer.buildjardir}/META-INF/ejb-jar.xml" />
    <copyfile src="weblogic-ejb-jar.xml"
dest="${customer.buildjardir}/META-INF/weblogic-ejb-jar.xml" />
    <delete file="${customer.ejbjar}"/>
    <jar jarfile="${customer.ejbjar}" basedir="${customer.buildjardir}"/>
    <deltree dir="${customer.buildjardir}"/>
  </target>

All of this work fine.

${customer.ejbjar} is defined as ../build/customerEjb.jar

In this build.xml I also have

<target name="ejbc" depends="init">
  	<java classname="weblogic.ejbc" fork="no"
classpath="${weblogic.classpath}" args="-compiler javac ${customer.ejbjar}
${customer.ejbcjar}"/>
  </target>

Now.

when I execute ant or build.bat which executes ant from
jps1.1.2/src/components/build.bat I get

D:\Java\JPS11~1.2\src\components>build
Buildfile: build.xml
Project base dir set to: D:\Java\jps1.1.2\src\components
Executing Target: init
Executing Target: core
Project base dir set to: D:\Java\jps1.1.2\src\components\util\tracer\src
Project base dir set to: D:\Java\jps1.1.2\src\components\util\tracer\src
Executing Target: init
Executing Target: compile_classes
Executing Target: core
Project base dir set to: D:\Java\jps1.1.2\src\components\customer\src
Project base dir set to: D:\Java\jps1.1.2\src\components\customer\src
Executing Target: init
Executing Target: compile_util_classes
Executing Target: compile_classes
Executing Target: customerejbjar
Created dir: D:\Java\jps1.1.2\src\components\customer\build\ejbjar\META-INF
Copying 48 files to D:\Java\jps1.1.2\src\components\customer\build\ejbjar
Copying 1 files to D:\Java\jps1.1.2\src\components\customer\build\ejbjar
Deleting: D:\Java\jps1.1.2\src\components\customer\build\customerEjb.jar
Building jar: D:\Java\jps1.1.2\src\components\customer\build\customerEjb.jar
Deleting: D:\Java\jps1.1.2\src\components\customer\build\ejbjar
Executing Target: ejbc
ERROR: ejb-jar file: ../build/customerEjb.jar could not be opened.

D:\Java\JPS11~1.2\src\components>

If I cd into the customer component directory

ie. jps1.1.2\src\components\customer\src

and run ant

I get

D:\Java\JPS11~1.2\src\components\customer\src>build
Buildfile: build.xml
Project base dir set to: D:\Java\jps1.1.2\src\components\customer\src
Executing Target: init
Executing Target: compile_util_classes
Executing Target: compile_classes
Executing Target: customerejbjar
Created dir: D:\Java\jps1.1.2\src\components\customer\build\ejbjar\META-INF
Copying 48 files to D:\Java\jps1.1.2\src\components\customer\build\ejbjar
Copying 1 files to D:\Java\jps1.1.2\src\components\customer\build\ejbjar
Deleting: D:\Java\jps1.1.2\src\components\customer\build\customerEjb.jar
Building jar: D:\Java\jps1.1.2\src\components\customer\build\customerEjb.jar
Deleting: D:\Java\jps1.1.2\src\components\customer\build\ejbjar
Executing Target: ejbc

...

Why is there a difference in the way the paths are seen here?

NOTE: that when runing the customerejbjar rule from

jps1.1.2\src\components it correctly builds the customerEjb.jar in the build
directory so why can't it find that same file when I want to run ejbc rule?




RE: Help with Ant problem...

Posted by Robert Nicholson <ro...@elastica.com>.
When running ant via an ant task what are relative directories in the
build.xml file relative to?

> -----Original Message-----
> From: Robert Nicholson [mailto:robert@elastica.com]
> Sent: Tuesday, May 15, 2001 1:34 PM
> To: Ant-User
> Subject: Help with Ant problem...
>
>
> I've ported the petstore 1.1.2 to weblogic 6.0 and one of the rules I've
> created is
>
> an ejbc rule
>
> Do not try to run ejbc at deployment time in Weblogic 6 with
> petstore.ear it
> won't work
> as it cannot , at that time, correctly resolve classes across jars. So I
> have to run
> ejbc before deployment.
>
> now... I'm a little confused as I have the following directory structure
>
> jps1.1.2/src/components/build.xml
> jps1.1.2/src/components/customer/src/build.xml
>
> the first build.xml invokes the following rule
>
> <target name="core" depends="init">
>     <ant antfile="${tracer.home}/src/build.xml" dir="${tracer.home}/src"
> target="core" />
>     <ant antfile="${customer.home}/src/build.xml"
> dir="${customer.home}/src"
> target="core" />
>     <ant antfile="${personalization.home}/src/build.xml"
> dir="${personalization.home}/src" target="core" />
>     <ant antfile="${inventory.home}/src/build.xml"
> dir="${inventory.home}/src" target="core" />
>     <ant antfile="${signon.home}/src/build.xml" dir="${signon.home}/src"
> target="core"/>
>     <ant antfile="${shoppingcart.home}/src/build.xml"
> dir="${shoppingcart.home}/src" target="core" />
>     <ant antfile="${mail.home}/src/build.xml" dir="${mail.home}/src"
> target="core" />
>   </target>
>
> So this runs ant on the customer/src/build.xml rule and it executes
> this rule
>
> customerejbjar which looks like this
>
> <target name="customerejbjar" depends="init">
>     <property name="customer.buildjardir"
> value="${customer.home}/build/ejbjar"/>
>     <mkdir dir="${customer.buildjardir}/META-INF"/>
>     <copydir src="${customer.classbindir}"
> dest="${customer.buildjardir}" />
>     <copydir src="${util.classbindir}" dest="${customer.buildjardir}" />
>     <copyfile src="customer_ejb.xml"
> dest="${customer.buildjardir}/META-INF/ejb-jar.xml" />
>     <copyfile src="weblogic-ejb-jar.xml"
> dest="${customer.buildjardir}/META-INF/weblogic-ejb-jar.xml" />
>     <delete file="${customer.ejbjar}"/>
>     <jar jarfile="${customer.ejbjar}" basedir="${customer.buildjardir}"/>
>     <deltree dir="${customer.buildjardir}"/>
>   </target>
>
> All of this work fine.
>
> ${customer.ejbjar} is defined as ../build/customerEjb.jar
>
> In this build.xml I also have
>
> <target name="ejbc" depends="init">
>   	<java classname="weblogic.ejbc" fork="no"
> classpath="${weblogic.classpath}" args="-compiler javac ${customer.ejbjar}
> ${customer.ejbcjar}"/>
>   </target>
>
> Now.
>
> when I execute ant or build.bat which executes ant from
> jps1.1.2/src/components/build.bat I get
>
> D:\Java\JPS11~1.2\src\components>build
> Buildfile: build.xml
> Project base dir set to: D:\Java\jps1.1.2\src\components
> Executing Target: init
> Executing Target: core
> Project base dir set to: D:\Java\jps1.1.2\src\components\util\tracer\src
> Project base dir set to: D:\Java\jps1.1.2\src\components\util\tracer\src
> Executing Target: init
> Executing Target: compile_classes
> Executing Target: core
> Project base dir set to: D:\Java\jps1.1.2\src\components\customer\src
> Project base dir set to: D:\Java\jps1.1.2\src\components\customer\src
> Executing Target: init
> Executing Target: compile_util_classes
> Executing Target: compile_classes
> Executing Target: customerejbjar
> Created dir:
> D:\Java\jps1.1.2\src\components\customer\build\ejbjar\META-INF
> Copying 48 files to D:\Java\jps1.1.2\src\components\customer\build\ejbjar
> Copying 1 files to D:\Java\jps1.1.2\src\components\customer\build\ejbjar
> Deleting: D:\Java\jps1.1.2\src\components\customer\build\customerEjb.jar
> Building jar:
> D:\Java\jps1.1.2\src\components\customer\build\customerEjb.jar
> Deleting: D:\Java\jps1.1.2\src\components\customer\build\ejbjar
> Executing Target: ejbc
> ERROR: ejb-jar file: ../build/customerEjb.jar could not be opened.
>
> D:\Java\JPS11~1.2\src\components>
>
> If I cd into the customer component directory
>
> ie. jps1.1.2\src\components\customer\src
>
> and run ant
>
> I get
>
> D:\Java\JPS11~1.2\src\components\customer\src>build
> Buildfile: build.xml
> Project base dir set to: D:\Java\jps1.1.2\src\components\customer\src
> Executing Target: init
> Executing Target: compile_util_classes
> Executing Target: compile_classes
> Executing Target: customerejbjar
> Created dir:
> D:\Java\jps1.1.2\src\components\customer\build\ejbjar\META-INF
> Copying 48 files to D:\Java\jps1.1.2\src\components\customer\build\ejbjar
> Copying 1 files to D:\Java\jps1.1.2\src\components\customer\build\ejbjar
> Deleting: D:\Java\jps1.1.2\src\components\customer\build\customerEjb.jar
> Building jar:
> D:\Java\jps1.1.2\src\components\customer\build\customerEjb.jar
> Deleting: D:\Java\jps1.1.2\src\components\customer\build\ejbjar
> Executing Target: ejbc
>
> ...
>
> Why is there a difference in the way the paths are seen here?
>
> NOTE: that when runing the customerejbjar rule from
>
> jps1.1.2\src\components it correctly builds the customerEjb.jar
> in the build
> directory so why can't it find that same file when I want to run
> ejbc rule?
>
>
>