History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: CIB-1330
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: jason
Reporter: Ruben Kerkhof
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Pulse

Build specification properties cannot reference properties introduced by required resources

Created: 19/Nov/07 05:36 PM   Updated: 23/Nov/07 04:49 AM
Component/s: Projects
Affects Version/s: 1.2.38
Fix Version/s: 2.0.5, 1.2.39

Environment: Windows 2003, ant 1.6.5, jkd 1.4


 Description  « Hide
Hi,

In my build specification, I've set a CLASSPATH environment entry.
I need to add certain ant libs to the front of the classpath, they're in ant's libdir but ${env.ANT_LIB_DIR}, ${env.ANT_HOME}, ${ant.lib.dir} etc are all not expanded.

So my classpath is: ${env.ANT_LIB_DIR}\\ant.jar;${env.BEA_HOME}\\weblogic81\\server\\lib\\weblogic.jar.
I've added BEA_HOME myself, and that one is expanded.

I can see ANT_HOME and friends env.txt, for what it's worth.

 All   Comments   Change History      Sort Order:
jason - 20/Nov/07 12:37 PM
Hi Ruben,

Thanks for the report. My first guess is that there may be a timing/ordering issue that means these variables are resolved prior to the env.* variables being defined. I will take a look and get back to you!

Ruben Kerkhof - 20/Nov/07 12:51 PM
Hi Jason,

Thanks for looking into this. The reason I need to add the ant jars is because Weblogic ships it's own version of ant, so I have to make sure my ant jars are in front of the classpath.

I hope you'll be able to find out what's wrong. Let me know if you need more information!

jason - 21/Nov/07 03:00 AM
Hi Ruben,

I am having trouble reproducing the issue. Here is my setup:

1) I did a clean Pulse 1.2.38 install, which auto-detected an ant resource for my version of ant (1.7.0)
2) I added an ant project with the single defalt build spec.
3) I added a property to the build specification named "CLASSPATH" with value:

    ${env.ANT_HOME}\\ant.jar;${env.BEA_HOME}\\weblogic81\\server\\lib\\weblogic.jar

I checked both the "add to environment" and "resolve variables" boxes.
4) When I trigger a build, the value of CLASSPATH in env.txt is as expected.

I assume there is something different with my setup?

Ruben Kerkhof - 21/Nov/07 11:10 AM
Hi Jason,

We're using ant 1.6.5, but I reproduced it with 1.7.
I had to delete the 1.6.5 resource to get Pulse to use 1.7, adding it as a resource on the build specification didn't help.

I haven't defined ANT_HOME in my environment, maybe you have?

This is from my env.txt:

Command Line:
2 -------------
3 D:\apache-ant-1.7.0\bin\ant.bat -f build.xml
4
5 Process Environment:
6 --------------------
7 =C:=C:\Program Files\Zutubi\Pulse Server\bin
8 ALLUSERSPROFILE=C:\Documents and Settings\All Users
9 ANT_HOME=D:\apache-ant-1.7.0
10 ANT_OPTS=-Xmx1024m -Xms512m
11 APPDATA=C:\Documents and Settings\srv_etwbea\Application Data
12 APR_ICONV_PATH=C:\Program Files\Subversion\iconv
13 BEA_HOME=d:\bea8
14 BEA_VERSION=8.1
15 CLASSPATH=${env.ANT_HOME}\lib\ant.jar;d:\bea8\weblogic81\server\lib\weblogic.jar;E:\buildserver\recipes\2129931\base\common\classes;E:\buildserver\recipes\2129931\base\lib\all_3rdparty.jar

Regards,

Ruben

jason - 21/Nov/07 12:16 PM
Hi Ruben,

Thanks for the further details. I did indeed have ANT_HOME in my environment, which exlains the difference. The issue here is the order in which the properties are introduced into the build. At the moment the required resources are imported after the properties defined on the buil specification. This seems backward, as the properties defined closer to the build (i.e. those on the spec) should be introduced later. I will change this for the 1.2.39 release.

Also, note that you do not need to use the env. prefix to reference a property defined on your resource. This prefix is only really needed to reference the environment defined outside of Pulse.

Lastly, you should be able to have two versions of the ant resource defined, but an Ant command will always pull in the default version of the resource. This may be why adding 1.7.0 did not work for you. You can control this by either changing the default ant version or converting to a custom project and editing the <resource> tag to pull in the desired version.

jason - 21/Nov/07 12:19 PM
Fixed in change 3973.

Ruben Kerkhof - 21/Nov/07 01:23 PM
Hi Jason,

> Thanks for the further details. I did indeed have ANT_HOME in my environment, which exlains the difference. The issue here is the order in which
> the properties are introduced into the build. At the moment the required resources are imported after the properties defined on the buil specification.
> This seems backward, as the properties defined closer to the build (i.e. those on the spec) should be introduced later.
> I will change this for the 1.2.39 release.

Wow, glad you've found it. Thanks!

> Also, note that you do not need to use the env. prefix to reference a property defined on your resource.
> This prefix is only really needed to reference the environment defined outside of Pulse.

Ah, thats works indeed, great tip.

> Lastly, you should be able to have two versions of the ant resource defined, but an Ant command will always pull in the default version of the resource.
> This may be why adding 1.7.0 did not work for you. You can control this by either changing the default ant version
> or converting to a custom project and editing the <resource> tag to pull in the desired version.

Switching the default helps, but that switches the ant version globally.
I have different specs that need to build with different versions of ant (don't ask ;-)
If I understand you correctly, I'd have to convert to custom projects.
Does this mean that adding a specific ant resource version to a spec has no effect?

Cheers,

Ruben



jason - 21/Nov/07 01:47 PM
Hi Ruben,

That is right, you would need a custom project. Adding a specific resource to the specs will not help as an ant project pulls in the resource even deeper, within the Pulse file itself, so it would override your resource. The easiest thing to do is probably to convert to custom and remove the <resource> tag. Then you can add the specific resource versions to each of your specs.

jason - 23/Nov/07 04:49 AM
Merged to trunk in change 3933.