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:
Issue wasresolved
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
and add required
system.variable_name=path
Please re-open the issue, as this is a really high priority one!
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.
It's a critical bug after all.
I am running 1.2 and have tried adding the following to my buildAgent.properties - and it still doesn't work??
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
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.
For Ipr runner, you need to specify path.macro.VAR system property.
For Inspection runner, you need to specify just VAR system property.
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).