How do I get locaton of invoking ".idea" project root from module specific ant invocation from a value set in the root project?

I have modules which are included in several root projects, they have ant files that should change their behavior depending on which project has invoked them.   I have been unable to see how I can pass the value of the path to the root invoking project to an ant property or an environment variable to an ant script/target defined as part of a module.

Can this be done?

The desire is so nothing has to be changed depeding on which project is building the module and the value can be inherited from some setting made at the project (not the machine or user on the machine) level.  And that items can be found relative to the project root of the invoking project.

Thanks

4 comments
Comment actions Permalink

Hi Peter,

After you add your ant files to the "Ant" toolwindow, you are able to invoke tasks from these files from the IDE. Once a buildfile is added to this toolwindow, there are "Build File Properties" available (invoke Alt-Enter on selected file or select the "Properties" action from the context menu), where you can set various running parameters and define some properties that will be defined for the running build file.
When defining a property in the "Properties" tab, you may use various Macros, like $ProjectFileDir$, for example: just start editing the property's value and click on the "+" button on the right side of the values's editor field: a macro-chooser dialog will appear, listing all available macros.
Hope this helps,

Regards,
Eugene.

0
Comment actions Permalink

Thanks - this will do - though for real I would want to be able to set it up to invokea specific ant task for a module to do pre-compile and post compile operations on a module by module basis instead of only project wide but the answer is helpful.

0
Comment actions Permalink

> p to invokea specific ant task for a module to do pre-compile and post compile

Right-click on a task and select "Execute On" group. It is possible to set the task to be run before/after compilation or running/debugging.  

0
Comment actions Permalink

Thanks aware of this it is good to have.  But as you can't assign a task ( or a script of any kind ) to execute when a *module* target (pre compile, compile, post compile) is invoked you can't have a script for a module which will be executed in module dependncy order - i use scripts for things like code geenration, source code proprocessing, resource creation and the like - intelliJ is great for getting some things up fast using the ide but there is not a good waty to incrementally move from a complex intellij project to a 100% scripted build or build a hybrid using the best advantages of both.  There is not a good wat to have intellik control scripts or scripts control intellij with one or the other hosting the configuration for both.

0

Please sign in to leave a comment.