Reference a path outside the project directory - gradle

learning Gradle, and I am running into an issue. I'd like to add the JAR files from the TomcatEE directory to the compilation classpath, and the tomcatEE directory lives outside the project hierarchy on the file system. For example, the tomcatEE directory is "C:/servers/tomcatee/". I want to define a property "tomcarDir" and then add tomcatDir + '/lib/' to the build path, but Gradle insists on appending the project directory to the start. How do I specify an absolute path like this?

I found my error. In my gradle.properties file, I had the path to the tomcat directory enclosed in single quotes. By removing them, Gradle started treating it as an absoolute file path.

Related

cant get POM file to set the outputDirectoryas as the project root

I have a POM.xml file and when i compile it it spits out the files in a default directory within the project. Is there a way to specify the file output within the
<outputDirectory>.</outputDirectory>
field? I would likle the file output to be in the root of the project folder. i want the output directory to be able to work for multiple users wherever the project is located within a computer.so it must not be specific for a single user. Is this possible?

How is the root folder of Multi build project determined in gradle?

Before projects are built Settings object is created which contains rootDir variable.
rootDir : The root directory of the build. The root directory is the project directory of the root project.
Also the documentation states it can never be null.
File getRootDir()
Returns the root directory of the build. The root directory is the project directory of the root project.
Returns:
The root directory. Never returns null.
I want to know how is rootDir determined in Multi build project. Is it the highest level directory containing build.gradle?
The details can be discovered in test specification
Simple version: it goes up directory hierarchy and searches for settings.gradle file. If it is not found or when started with --no-search-upward it can return current directory. Or you can pass location of settings.gradle using --settings-file.

How to make GPE see my war directory?

I already have a war directory created through maven and i would like to use that directory instead of src/main/webapp but the target directory is not seen by GPE . Other than project refresh i do not know what wlse to try.
Change Default Output Folder path from Java Build Path-> Source

How to make a path relative in the vmargs?

In my project I have an eclipse cdo-server which is set up as described here: http://wiki.eclipse.org/Setting_up_a_CDO_Server .
My project structure is like this:
-cdo-server plugin
|- config folder with cdo-server.xml
|- pom.xml
-cdo-server-product
|-pom.xml
-master
|-pom.xml
When I start my cdo-server.product as Eclipse application everything works fine.
When I build it and materialize it with Maven, it also has a BUILD SUCCESS. But when I start the CDO-CommonRepositoryServer.app which was built with Maven, there is the error:
!MESSAGE CDO server configuration not found:
/Users/pathtoCDO-Server/CDO-CommonRepositoryServer.app/Contents/MacOS/${resource_loc:/cdo.server/config}/cdo-server.xml.
This is logical, because this is the wrong path. When I enter the absolute path to the cdo-server.xml in the vmargs (-Dnet4j.config=/Users/pathtoCDO-config/cdo-server.xml) it also works. However, I want to make it relative, so that everybody in our git-repo can use it and not only in my folder structure.
Is there any possibility to make this path relative?
With -Dnet4j.config="${resource_loc:/cdo.server/config}" it only works when i run it as an eclipse application, but not as maven built .app file.
Update:
Now I can start the CDO-CommonRepository.app file if I take
-Dnet4j.config=../../../../../../../../../../cdo.server/config
as path, but then I can only start it with the maven built file and I cannot start it from inside Eclipse anymore...
I've created a new question for this new problem: Slash in property name in pom.xml
I just solved my problem in copying my files with Maven copy-resources in this stupid /Users/pathtoCDO-Server/CDO-CommonRepositoryServer.app/Contents/MacOS/${resource_loc:/cdo.server/config}/cdo-server.xml folder.

p2.inf Filtering in Tycho when building an RCP application

I´m building an RCP application using tycho. The RCP application uses p2 and its self updateable capabilities configuring the respository in an p2.inf file. Works like a charm.
Now I want to introduce a placeholder ${updatesiteurl} in the p2.inf file and replace it with the URL according to the environment for which it is built. But unforunately it get´s replaced with an empty string instead of the environment variable which I guess happens because tycho, or the p2 director, replaces some escaped characters (like the ":" which is ${58} for example).
Any ideas how this could be solved? I thought about explicitly declaring the resource plugin and binding it to an earlier build phase but that didn´t work either...
What finally worked is: I moved the p2.inf file to directory /p2 and let the maven resource plugin copy the file with the replacements to a temporary folder in /target. Now a copy task copies the file in a later phase (why the hell didn´t this work in the same phase...) to the the root directory, where the .product file is, since both have to be in the same directory (with the same prefix). Finally clean deletes the p2.inf file in the root directory...

Resources