Slash in property name in pom.xml

1.2k Views Asked by At

I have a problem, what I cannot solve.

I want to build my eclipse cdo server with Tycho/Maven and also I want to have the prossibility to start my cdo-server.product out of eclipse.

The cdo server it set up like this: http://wiki.eclipse.org/Setting_up_a_CDO_Server

No there is my problem: If I choose:

-Dnet4j.config="${resource_loc:/cdo.server/config}"

I can start it out of eclipse, but if I want to start the built CDO-Server.app it cannot find this folder.

If I choose:

-Dnet4j.config="../../../../../../../../../../cdo.server/config"

I can start the built CDO-Server.app, but I can't start it ou of eclipse.

This is all logical, but now I decided to make ${resource_loc:/cdo.server/config} as a property in my pom.xml file. But if I write it like this:

<properties>
<resource_loc:/cdo.server/config>../../../../../../../../../../cdo.server/config</resource_loc:/cdo.server/config>
</properties>

I get the exception, that this is not a parseable POM because of the slash in the tag.

If I want to make it like this:

<properties>
    <resource_loc:>
        <cdo.server>
           <config>../../../../../../../../../../cdo.server/config</config>
    </cdo.server>
    </resource_loc:>
</properties>

It also is not a parseable POM. Is there any possibility to use ${resource_loc:/cdo.server/config} as a property?

2

There are 2 best solutions below

3
On

The problem in your property definition are the slashes in the name of the property.

The following will fail parsing the pom.xml:

<resource_loc:/cdo.server/config>yx</resource_loc:/cdo.server/config>

or WhatEverValue

It will also not working if you try to use / as a replacement for the slash in the entity name.

0
On

you may want to try http://mojo.codehaus.org/properties-maven-plugin/read-project-properties-mojo.html to read the properties from a separate file instead in order to get around the XML well-formedness limitation in pom.xml.