Giovanni Lovato
Giovanni Lovato

Reputation: 2273

Default pom.xml for new Eclipse Maven projects

I'm on Eclipse Neon.1 and when I create new Maven projects I get a default pom.xml with this content:

<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>

  <groupId>com.example</groupId>
  <artifactId>test</artifactId>
  <version>0.0.1-SNAPSHOT</version>

  <name>test</name>

</project>

How can I modify this default template? I'd like to add some properties, for example

<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>

    <groupId>com.example</groupId>
    <artifactId>test</artifactId>
    <version>0.0.1-SNAPSHOT</version>

    <name>test</name>

    <properties>
        <encoding>UTF-8</encoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>

</project>

Of course I can create my own archetype and use it to have this pom, but the m2e plugin is so configurable I hope this is possible without an archetype.

Upvotes: 10

Views: 1542

Answers (1)

oliver_t
oliver_t

Reputation: 1095

The question is, which archetype is actually used, when you skip the archetype selection. My first thought was, that it must be maven-archetype-quickstart. This would be the default when stepping into the archetype selection.

But the sad truth is, that no archetype is used at all and the POM is filled directly with the minimal set of values (groupId/artifactId/version). This is hard coded and cannot be changed or extended with your properties. Sorry.

Upvotes: 2

Related Questions