Re: Need help from expert

Adam Bruss <[email protected]>
Newsgroups gmane.comp.java.cruise-control.user
Message-ID <[email protected]>
Hmm well just to clarify you can get the cruisecontrl project name in your build script by doing ${projectname} as shown in the link given by Julian. So in theory you can use this to access the right database schema at build time.

Some example ant script:

<target name="access-schema">
                <echo message="cc project name: ${projectname}"/>
                ...
</target>

A bootstrapper is a cruisecontrol construct. It allows you to run executables or build scripts before the build would begin. For example it's very useful for checking out version controlled build script files on the build machine. This way you can commit changes on your development machine and
They will automatically be used on the build machine. If you need to do some build-pre-processing then you could use a bootstrapper.

Here's an example of the svnbootstrapper in a cruisecontrol config file.

<project name="my-project" buildafterfailed="false" requireModification="true">
                <modificationset>
                                <filesystem folder="${fullbuildnotifier.path}" />
                </modificationset>

                <bootstrappers>
                                <svnbootstrapper
                                                localWorkingCopy="c:\\working-copy"
                                                username="user"
                                                password="pass">
                                </svnbootstrapper>
                </bootstrappers>
...
</project>

In conclusion

You said this:
   "We have a problem for a while when cruisecntrol builds the projects all projects trying to access same database schema. My manager asked me to take each project name then pass as database schema name to eliminate the conflict."

Is it sufficient then to use ${projectname} in your build script to access the right schema?

-Adam

From: Michelle Mu [mailto:[email protected]]
Sent: Monday, June 13, 2011 4:23 PM
To: [email protected]
Subject: Re: [Cruisecontrol-user] Need help from expert

Julian,
    We need to take out the project name for some other purposes other than only build the project by cc. We have cc configured building the projects. Thanks.

    Michelle

--- On Mon, 6/13/11, Julian Simpson <[email protected]> wrote:

From: Julian Simpson <[email protected]>
Subject: Re: [Cruisecontrol-user] Need help from expert
To: [email protected]
Date: Monday, June 13, 2011, 3:11 PM

On 13 June 2011 21:56, Michelle Mu <[email protected]<http://us.mc1147.mail.yahoo.com/mc/[email protected]>> wrote:
Adam,

   I am so glad to get your response quickly.

  We have a problem for a while when cruisecntrol builds the projects all projects trying to access same database schema. My manager asked me to take each project name then pass as database schema name to eliminate the conflict. I have a piece of the code like below. But I am not sure if it is right because we need each project name controlled by cc when build. I checked the cc source. There are some methods, getProjectName(), return project name. But I did not find proper one. I like getProjectName() in ProjectEvent.java but there is not constructor to call it.


If I understand your problem, I don't think you need to do this. CruiseControl will tell you the project name, when it invokes your build tool:

http://cruisecontrol.sourceforge.net/main/configxml.html#buildproperties

Best

Julian.



You mentioned Bootstrappers in your email. I don't understand the meaning. If I need to use API under bootstrappers? How or which class and methods?

You are an expert for CC. Can you provide more detail help? Thank you very much?

    Michelle



String confFile = "config.xml";

File configurationFile =
new File("confFile");
try{

    XMLConfigManager configManager =
new XMLConfigManager(configurationFile);

    Set<String> projectNames = configManager.getCruiseControlConfig().getProjectNames();
for(String projectName: projectNames){

   System.
out.println("projectName");

}

}
catch(CruiseControlException cce){
}


--- On Mon, 6/13/11, Adam Bruss <[email protected]<http://us.mc1147.mail.yahoo.com/mc/[email protected]>> wrote:

From: Adam Bruss <[email protected]<http://us.mc1147.mail.yahoo.com/mc/[email protected]>>
Subject: Re: [Cruisecontrol-user] Need help from expert
To: "[email protected]<http://us.mc1147.mail.yahoo.com/mc/[email protected]>" <[email protected]<http://us.mc1147.mail.yahoo.com/mc/[email protected]>>
Date: Monday, June 13, 2011, 2:06 PM

You can parse the cc config.xml files and get a list of projects that way by using xml. The task to do this could be in a ant bootstrapper for example. Bootstrappers are run before a build starts. Ant has an xml jar that does xml parsing.

What do you need to do with the list of projects?

Adam Bruss
Senior Development Engineer
AWR Corporation
11520 N. Port Washington Rd., Suite 201
Mequon, WI  53092  USA
P: 1.262.240.0291 x104
F: 1.262.240.0294
E: [email protected]
W: http://www.awrcorp.com<http://www.awrcorp.com/>

From: Michelle Mu [mailto:[email protected]<http://us.mc1147.mail.yahoo.com/mc/[email protected]>]
Sent: Monday, June 13, 2011 2:51 PM
To: [email protected]<http://us.mc1147.mail.yahoo.com/mc/[email protected]>
Subject: [Cruisecontrol-user] Need help from expert

Hi,
   I have a technical question. I do not know if someone can help me. I am working on the project that uses cruisecontrol to build our java project. What I want to get is the string of each projectName configured inside config.xml. But I want to get the project name during the build event processing. Can someone tell me if there is a way or how to get each project name when cruisecontrol is scheduled to build eachtime? Really appreciate for the help. Thanks.

   Michelle Mu


-----Inline Attachment Follows-----
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev

-----Inline Attachment Follows-----
_______________________________________________
Cruisecontrol-user mailing list
[email protected]<http://us.mc1147.mail.yahoo.com/mc/[email protected]>
https://lists.sourceforge.net/lists/listinfo/cruisecontrol-user


------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
Cruisecontrol-user mailing list
[email protected]<http://us.mc1147.mail.yahoo.com/mc/[email protected]>
https://lists.sourceforge.net/lists/listinfo/cruisecontrol-user



--
Julian Simpson
The Build Doctor Ltd.
http://www.build-doctor.com<http://www.build-doctor.com/>
[email protected]<http://us.mc1147.mail.yahoo.com/mc/[email protected]>
(+44) 207 183 0323


-----Inline Attachment Follows-----
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev

-----Inline Attachment Follows-----
_______________________________________________
Cruisecontrol-user mailing list
[email protected]<http://us.mc1147.mail.yahoo.com/mc/[email protected]>
https://lists.sourceforge.net/lists/listinfo/cruisecontrol-user

------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev

_______________________________________________
Cruisecontrol-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cruisecontrol-user
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.