Back    
Priority:
Type:
State:
Assignee:
Subsystem:
Affected versions:
Fixed in:

TW-1084

IPR runner doesn​'​t replace "​path variables​" in project files before execution

5
Our Intellij project files have references to so-called "path variables" in it (e.g. $M2_REPOSITORY$) (see Intellij IDEA). Path variables are useful as placeholders when pointing to a library repository and where that location isn't always the same. (e.g. think of Windows and Linux cross-platform compatibility of project files).

The agent doesn't replace these placeholders in the project files with real values (e.g. stored in an environment variable or system property) before running, causing the build to fail.

Unfortunately we cannot adjust the project files with absolute paths for the following reasons:

  • Different developers have the local Maven 2 repository at different locations
  • Developers work on Windows while the TeamCity builds are done on Linux

Issue wasresolved
Comments (12)
History (1)
Dave Whitla Dave Whitla 06 Dec 2006 16:06 (2 years ago)
Exactly the same problem for me
Alexey Gopachenko Alexey Gopachenko 06 Dec 2006 16:18 (2 years ago)
Path variables can be configured through system properties on agent. Navigate to BuildAgent\conf\buildAgent.properties
and add required
system.variable_name=path
Tobias Kurzke Tobias Kurzke 11 Dec 2006 13:58 (2 years ago)
It doesn't work, the set variables aren't resolved by the build agent.
Please re-open the issue, as this is a really high priority one!
Alexey Gopachenko Alexey Gopachenko 11 Dec 2006 14:30 (2 years ago)
Can you please provide more detailed description of what are you doing, what is expected and acheived result?
Tobias Kurzke Tobias Kurzke 11 Dec 2006 14:38 (2 years ago)
I defined several system variables in the build agent's property file as you described above.
For example, one of the entries in the property file is as follows:
system.M2_REPO=C\:\\Documents and Settings\\mstku\\.m2\\repository

In the .ipr file (and the referenced .iml-files), the path variable M2_REPO is used, which works perfectly well if I use the project in IDEA.
When I create a build configuration in TeamCity that uses the same .ipr-file, the build log contains warnings like this:

[2006-12-11 11:52:15,643] INFO - nt.runner.GenericProgramRunner - [generateBuild] Warning: C:/BuildAgent/work/6_MilanoFutureComplete/IdeaFuture/$M2_REPO$/log4j/log4j/1.2.12/log4j-1.2.12.jar - Library file doesn't exist

All the libraries in the Maven repository aren't found, because $M2_REP$ isn't resolved.
Tobias Kurzke Tobias Kurzke 13 Dec 2006 16:37 (2 years ago)
It would be great if this could be already fixed in 1.2, because otherwise the .ipr runner is useless in a shared environment until February, and this is just an estimate...
It's a critical bug after all.
Kirill Maximov Kirill Maximov 13 Dec 2006 17:58 (2 years ago)
Will fix in 1.2
Kirill Maximov Kirill Maximov 12 Jan 2007 16:41 (2 years ago)
For each path variable you'll have to specify path.macro.VARNAME system property. In your case you'll have to specify path.macro.M2_REP system property and set it to corresponding value.
Niels Ull Harremoës Niels Ull Harremoës 17 Jan 2007 15:14 (2 years ago)
Could you please document exactly how to acheive this?
I am running 1.2 and have tried adding the following to my buildAgent.properties - and it still doesn't work??

  1. Generated properties (see buildAgent.dist.properties for description)
  2. Wed Jan 17 09:22:51 CET 2007

serverUrl=http\://localhost\:80
name=PFACDBL04
workDir=F\:\\Builder_Work
env.JAVA_HOME=d\:\\jdk1.5.0_07
ownPort=9090
system.path.macro.MAVEN_REPOSITORY=f:\\maven_repo
path.macro.MAVEN_REPOSITORY=f:\\maven_repo
env.path.macro.MAVEN_REPOSITORY=f:\\maven_repo
MAVEN_REPOSITORY=f:\\maven_repo

And I have added these to the build settings.

And I have restarted the build agent.

But I still get the error:
In order for the project to load all path variables must be defined.: MAVEN_REPOSITORY


Tobias Kurzke Tobias Kurzke 17 Jan 2007 15:35 (2 years ago)
I get the same error when using the Inspection-runner:
java.lang.RuntimeException: There are undefined path variables in project configuration files.
In order for the project to load all path variables must be defined.: M2_SETTINGS, MILANO_FUTURE_HOME, M2_REPO

When using the Ipr-Runner (same project on same build agent), the build log contains this:
[generateBuild] Loaded external path macro $M2_REPO$=C:\Documents and Settings\mstku\.m2\repository
[generateBuild] Loaded external path macro $M2_SETTINGS$=C:\Documents and Settings\mstku\.m2
[generateBuild] Loaded external path macro $MILANO_FUTURE_HOME$=C:\BuildAgent\work\Milano_Future_Complete

It looks like Ipr runner correctly replaces the path variables while the Inspection runner still can't handle this.

Please re-open the issue and fix it asap.
Kirill Maximov Kirill Maximov 17 Jan 2007 16:04 (2 years ago)
Unfortunately, Inspection runner uses other syntax than Ipr runner. We'll fix this in Agra.
For Ipr runner, you need to specify path.macro.VAR system property.
For Inspection runner, you need to specify just VAR system property.
Tobias Kurzke Tobias Kurzke 17 Jan 2007 16:17 (2 years ago)
So in order to handle the Inspection runner and the Ipr runner, the buildagent.properties must contain something like

system.path.macro.M2_REPO=C\:\\Documents and Settings\\mstku\\.m2\\repository
and
system.M2_REPO=C\:\\Documents and Settings\\mstku\\.m2\\repository

I'm just asking, because it still doesn't work, running the Inspection runner with a build agent configured that way I still get

java.lang.RuntimeException: There are undefined path variables in project configuration files.
In order for the project to load all path variables must be defined.: M2_REPO

even If I configure these variable as system variable in the Inspection build configuration (which isn't necessary for Ipr-runner).