Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6217969
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:31:06+00:00 2026-05-24T07:31:06+00:00

Here’s the situation: I trying to make a ant test script that does the

  • 0

Here’s the situation: I trying to make a ant test script that does the following
1 – Runs a utility to create test data
2 – Runs junit suite
3 – Runs a utility to clean up test data.

The problems is parts 2 & 3 need to access to some static fields of the utility in 1 (e.g. generated unique names of test data). This issue I’m having is that it the static fields of the class are null when I try to access them as though the java task in #1 was run in a separate process or using a different classloader (I’ve tried setting the attribute fork=”false” on the java task and using -Dant.reuse.loader=true on the cmd line). Any ant gurus know what’s going on here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T07:31:06+00:00Added an answer on May 24, 2026 at 7:31 am

    Since you are dealing with different class loaders, you’ll never get past one’s class loader finding the “wrong” instance of the exact same class and hence using the “wrong” static value. You need to do the communications between the ant invocations via a file. A temporary file will likely not do, as it will likely be removed before the second set of ant classes get a chance to work with it.

    There are two issues, the generation of suitable property values, and the transmission of them between ant calls. Perhaps you don’t need all of this since your situation might already generate suitable identifiers, but it’s here if you do.

    To generate suitable values, one ant process should the propertyfile task to generate the appropriate names, with the per-run changing identifier as part of the name

    <propertyfile file="testConfig.properties.ids" comment="Machine generated file, do not edit!">
      <entry key="test.suite.1.id" type="int" operation="+" unit="1"/>
      <entry key="test.suite.2.id" type="int" operation="+" unit="1"/>
    </propertyfile>
    <properties file="testConfig.properties.ids"/>
    <propertyfile file="testConfig.properties" comment="Machine generated file, do not edit!">
      <entry key="test.suite.1.name" type="string" operation="=" value="TestSuite${test.suite.1.id}.sh"/>
      <entry key="test.suite.2.name" type="string" operation="=" value="TestSuite${test.suite.2.id}.sh"/>
    </propertyfile>
    

    Subsequent ant processes can then just source in the original ant process’s generated property file.

    <property file="testConfig.properties"/>
    

    Which will have the effect of defining

    test.suite.1.name=TestSuite34.sh
    test.suite.2.name=TestSuite83.sh
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here i make 5 Tab buttons that are working proper but now i want
Here's a basic regex technique that I've never managed to remember. Let's say I'm
Here is the issue I am having: I have a large query that needs
Here's my scenario - I have an SSIS job that depends on another prior
Here's a coding problem for those that like this kind of thing. Let's see
Here is the scenario: I'm writing an app that will watch for any changes
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
Basically, what I'm trying to create is a page of div tags, each has
Here's what I'm trying do to in a single SQL Server procedure: @ID1 int
Here, i have coded to get data from DB. I want to store the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.