Hello

I am trying to make a POM template for projects and templates,
for the developers to use as base when setting up new projects
or modules. For the ease of use I define all things to change
in a property section of each pom.

My Project root template pom looks loke this:

<project xmlns="http://maven.apache.org/POM/4.0.0"; 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
        http://maven.apache.org/maven-v4_0_0.xsd";> 
    <modelVersion>4.0.0</modelVersion>

    <properties>
        <projectCategory>framework</projectCategory>
        <projectName>Human Readable Name</projectName>
        <projectGroup>projectGroup</projectGroup>
        <projectLink>jira-link</projectLink>
    </properties>

    <parent>
        <artifactId>my-parent</artifactId>
        <groupId>my.company.pom</groupId>
        <version>0.1-SNAPSHOT</version>
    </parent>

    <groupId>my.company.${projectGroup}</groupId>
    <artifactId>project-${projectGroup}</artifactId>
    <packaging>pom</packaging>
    <name>${projectName}</name>
    <version>0.1-SNAPSHOT</version>
    <url>http://url-to-site/project/${artifactId}</url>

    ...
    <modules>
        <module>my-module</module>
    </modules>
            
</project>

and my modul template pom lokks like this:

<project xmlns="http://maven.apache.org/POM/4.0.0"; 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
        http://maven.apache.org/maven-v4_0_0.xsd";>
    <modelVersion>4.0.0</modelVersion>
    
    <properties>
        <parentProjectGroup>projectGroup</parentProjectGroup>
        <moduleName>Human Readable Name</moduleName>
        <moduleExtension>my-ext</moduleExtension>
        <modulePackaging>jar</modulePackaging>
    </properties>
    
    <parent>
        <artifactId>project-${parentProjectGroup}</artifactId>
        <groupId>project.${parentProjectGroup}</groupId>
        <version>0.1-SNAPSHOT</version>
    </parent>
    
    <groupId>${parent.groupId}</groupId>
    <artifactId>${parent.artifactId}-${moduleExtension}</artifactId>
    <packaging>${modulePackaging}</packaging>
    <name>${moduleName}</name>
    <version>${parent.version}</version>
    
    <!-- target for deployment -->
    <distributionManagement>
        <!-- site needs to be defined for every module -->
        <site>
            <id>deployment.site</id>
            <name>Insieme Site Repository</name>
 
<url>dav:http://site/project/${parent.artifactId}/${artifactId}/</url>
        </site>
    </distributionManagement>

Now as the model is not interpolated in the MavenProjectBuilder the
usage of
properties like this fails to resolve the parent.

I did some changes in the MavenProjectBuilder to interpolate all kind of
keys
generated, and now this scenario works. I don't know if this is the
right way to 
do this as it would be easy to interpolate the hole model after the
loading...
I didn't want to do this, as I don't know what happens later on.
I can now use properties in the parent node and also for groupId and
artifactId
on every level, when I now do a mvn install on the module it will deploy
the module
to the local repository, even if the parent is not deployed.

The strange thing about this is, that the pom deployed is also not fully
interpolated !

I think that deployed artefact's always should be interpolated, is this
correct ?

I currently don't know where this is done, but I think this has to be
done in the
deploy plugin... 

What are you thinking about all this crazy setup... ???

Daniel




 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to