Edit pom.xml template

HI, I use so many lugins in pom and pmost of them are very often used like surfire plugin or war plugin etc.  I want to make those as default in my generated pom. I tried editing default pom template in ide settings, but when project is generated, IDEA rewritten my pom, i dont know what magic they do internally. I just want to have a way where my commonly used plugin go default. And java 7 properties go default.
Please suggest a way.

What i tried doing in default template in IDE-SETTINGS  is :

<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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    #if (${HAS_PARENT})
    <parent>
        <groupId>${PARENT_GROUP_ID}</groupId>
        <artifactId>${PARENT_ARTIFACT_ID}</artifactId>
        <version>${PARENT_VERSION}</version>
#if (${HAS_RELATIVE_PATH})
        <relativePath>${PARENT_RELATIVE_PATH}</relativePath>
#end
    </parent>

#end

    <packaging>war</packaging>
<groupId>${GROUP_ID}</groupId>
    <artifactId>${ARTIFACT_ID}</artifactId>
    <version>${VERSION}</version>

    ${END}
    <!--<name></name>-->

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <!-- JAVA EE 7 API -->
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-api</artifactId>
            <version>7.0</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>


    <build>
        <finalName>${project.name}</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.0</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.3</version>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

1 comment
Comment actions Permalink

I would think to do what you want, you are better off using native Maven functionality and creating a new customized archetype.

See http://maven.apache.org/guides/mini/guide-creating-archetypes.html for a guide.

You can aloso create a localized 'parent' pom.xml file with common plugin and dependancy management settings.

See http://maven.apache.org/guides/introduction/introduction-to-the-pom.html#Project_Inheritance

0

Please sign in to leave a comment.