Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

[PROPOSAL]

...

Refactored

...

POM

...

Interpolation

...

in

...

Maven

...

2.0.x

...

Context

Related JIRA Issues

Related Subversion Feature Branch

...

Background

Since before the 2.0

...

release

...

of

...

Maven,

...

POM

...

interpolation

...

has

...

been

...

essentially

...

a

...

slightly

...

enhanced

...

version

...

of

...

static

...

property

...

resolution,

...

drawing

...

from

...

multiple

...

sources

...

but

...

always

...

substituting

...

static

...

information

...

in

...

place

...

of

...

expressions.

...

The

...

interpolator

...

implementation

...

contained

...

a

...

hard-coded

...

order

...

of

...

operations,

...

specifying

...

in

...

code

...

which

...

sources

...

were

...

checked

...

in

...

which

...

order,

...

without

...

any

...

higher-level

...

processing

...

of

...

any

...

values.

...

One

...

example

...

where

...

higher-order

...

processing

...

would

...

help

...

had

...

to

...

do

...

with

...

expressions

...

referencing

...

build

...

paths.

...

Specific

...

elements

...

within

...

the

...

POM

...

build

...

section

...

were

...

post-processed

...

to

...

transform

...

relative

...

paths

...

into

...

absolute

...

ones,

...

and

...

remove

...

any

...

sensitivity

...

to

...

the

...

varying

...

base

...

directories

...

that

...

came

...

with

...

multi-

...

versus

...

single-module

...

builds.

...

However,

...

when

...

these

...

build

...

paths

...

were

...

referenced

...

from

...

expressions

...

in

...

arbitrary

...

locations

...

of

...

the

...

POM,

...

tracking

...

these

...

injection

...

points

...

for

...

later

...

path

...

translation

...

was

...

very

...

difficult.

...

This

...

meant

...

that

...

build

...

paths

...

had

...

to

...

be

...

handled

...

in

...

a

...

very

...

specific

...

way,

...

to

...

avoid

...

injecting

...

relative

...

paths

...

into

...

arbitrary

...

locations

...

within

...

the

...

POM

...

then

...

losing

...

track

...

of

...

those

...

injection

...

points

...

when

...

it

...

came

...

time

...

to

...

translate

...

build

...

paths

...

from

...

relative

...

to

...

absolute.

...

As

...

this

...

interpolation

...

logic

...

evolved

...

through

...

subsequent

...

releases

...

of

...

Maven

...

2.0.x,

...

it

...

took

...

on

...

aspects

...

of

...

layered

...

resolution

...

coming

...

from

...

command-line

...

properties,

...

system

...

properties,

...

POM

...

properties,

...

and

...

POM

...

instance

...

values

...

(not

...

necessarily

...

in

...

that

...

order).

...

Environment

...

variables

...

from

...

the

...

operating

...

system

...

were

...

added

...

to

...

the

...

mix

...

at

...

one

...

point.

...

Through

...

all

...

of

...

this,

...

elements

...

coming

...

from

...

the

...

POM

...

itself

...

were

...

required

...

to

...

be

...

available

...

in

...

three

...

forms:

...

${pom.

...

},

...

${project.

...

},

...

and

...

un-prefixed

...

${

...

}

...

expressions.

...

Added

...

to

...

this,

...

environment

...

variables

...

were

...

distinguished

...

from

...

system

...

and

...

other

...

properties

...

using

...

the

...

${env.

...

}

...

expression

...

prefix.

...

All

...

of

...

these

...

prefix

...

variants

...

and

...

layered

...

value

...

sources

...

strained

...

the

...

original

...

interpolation

...

logic

...

more

...

and

...

more

...

with

...

each

...

successive

...

release,

...

and

...

use

...

cases

...

always

...

dropped

...

through

...

the

...

cracks...new

...

variants

...

with

...

each

...

change,

...

each

...

Maven

...

release.

...

Problem

At this point,

...

it

...

seems

...

obvious

...

that

...

the

...

original

...

interpolation

...

logic

...

used

...

in

...

Maven

...

2.0.x

...

is

...

naive

...

and

...

simplistic

...

when

...

compared

...

to

...

the

...

very

...

rich

...

set

...

of

...

sources

...

and

...

operations

...

that

...

need

...

to

...

be

...

applied

...

to

...

resolve

...

POM

...

expressions.

...

To

...

continue

...

patching

...

the

...

original

...

logic

...

-

...

which

...

was

...

never

...

designed

...

for

...

the

...

level

...

of

...

complexity

...

we

...

deal

...

with

...

now

...

when

...

interpolating

...

POMs

...

-

...

is

...

to

...

continue

...

to

...

ask

...

for

...

newly

...

broken

...

use

...

cases,

...

since

...

the

...

solutions

...

for

...

many

...

sets

...

of

...

use

...

cases

...

are

...

directly

...

at

...

odds

...

with

...

another

...

within

...

the

...

current

...

implementation.

...

Additionally,

...

interpolation

...

has

...

become

...

a

...

widespread

...

feature

...

either

...

present

...

or

...

requested

...

in

...

many

...

Maven

...

plugins,

...

not

...

to

...

mention

...

applications

...

that

...

use

...

Plexus

...

(the

...

underlying

...

container

...

for

...

Maven).

...

In

...

maintaining

...

separate

...

libraries

...

for

...

supporting

...

interpolation

...

inside

...

Maven's

...

core

...

and

...

from

...

plugins,

...

we

...

only

...

decrease

...

consistency

...

across

...

the

...

whole

...

system,

...

and

...

create

...

more

...

work

...

in

...

terms

...

of

...

maintaining

...

feature

...

parity

...

between

...

the

...

two

...

implementations.

...

In

...

order

...

to

...

address

...

these

...

problems,

...

a

...

solution

...

should

...

support

...

modularized

...

layering

...

of

...

interpolation

...

strategies.

...

Additionally,

...

to

...

reduce

...

the

...

overhead

...

and

...

inconsistency

...

associated

...

with

...

the

...

current

...

collection

...

of

...

three

...

or

...

more

...

interpolation

...

libraries,

...

a

...

solution

...

here

...

should

...

support

...

both

...

the

...

needs

...

of

...

Maven's

...

core

...

POM

...

interpolation

...

/and/

...

that

...

of

...

Maven's

...

plugins.

...

These

...

requirements

...

play

...

well

...

off

...

of

...

one

...

another,

...

since

...

plugins

...

often

...

require

...

the

...

traditional

...

value

...

sources

...

required

...

by

...

POM

...

interpolation,

...

plus

...

some

...

additional

...

strategies.

...

One

...

perfect

...

example

...

of

...

this

...

sort

...

of

...

interpolation

...

extension

...

can

...

be

...

found

...

in

...

the

...

Assembly

...

plugin,

...

which

...

allows

...

interpolation

...

from

...

dependency-artifact

...

or

...

module-artifact

...

metadata,

...

in

...

addition

...

to

...

POM

...

metadata.

...

Proposed

...

Solution

...

Since

...

the

...

2.2

...

refactor

...

of

...

the

...

Assembly

...

plugin,

...

a

...

new

...

interpolation

...

framework

...

has

...

been

...

under

...

development

...

in

...

the

...

plexus-utils

...

library.

...

This

...

framework

...

meets

...

all

...

of

...

the

...

requirements

...

above,

...

interpolating

...

expressions

...

from

...

plain-vanilla

...

String

...

input,

...

and

...

allowing

...

value-resolution

...

strategies

...

to

...

be

...

encapsulated

...

in

...

ValueSource

...

implementations

...

which

...

are

...

then

...

layered

...

in

...

as

...

successive

...

strategies

...

for

...

resolving

...

a

...

particular

...

expression's

...

value.

...

Recent

...

additions

...

go

...

much

...

further

...

than

...

the

...

other

...

interpolation

...

implementations

...

in

...

Maven,

...

even

...

supporting

...

multi-expression

...

cycle

...

detection

...

(a

...

trivial

...

example

...

of

...

this

...

might

...

be:

...

project.build.testSourceDirectory

...

references

...

project.build.sourceDirectory,

...

which

...

references

...

project.build.directory,

...

which

...

references

...

project.build.testSourceDirectory).

...

Such

...

multi-expression

...

cycles

...

can

...

be

...

particularly

...

insidious

...

where

...

descriptor

...

inheritance

...

is

...

allowed,

...

for

...

example

...

between

...

configurations

...

in

...

a

...

POM

...

and

...

its

...

parent.

...

Since

...

Maven's

...

history

...

concerning

...

the

...

plexus-utils

...

library

...

is

...

a

...

bit

...