Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven: Rename the application EAR

Tags:

java

maven

war

ear

I have a maven 2 ear modules.

For example, its artifact ID is MyApp. Maven creates ear archives whith name MyApp-1.0-SNAPSHOT.ear

I want to change default name.

I have this in the parent pom.xml:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <compilerVersion>${java.version}</compilerVersion>
                <source>${java.version}</source>
                <target>${java.version}</target>
            </configuration>
        </plugin>

    </plugins>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.2</version>
                <configuration>
                    <webResources>
                        <resource>
                            <directory>${basedir}/src/main/webapp/WEB-INF</directory>
                            <targetPath>WEB-INF</targetPath>
                            <includes>
                                <include>**/*.xml</include>
                            </includes>
                            <filtering>true</filtering>
                        </resource>
                    </webResources>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-ear-plugin</artifactId>
                <version>2.7</version>
                <configuration>
                    <filtering>true</filtering>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>

    <resources>
        <resource>
            <directory>src/main/resources</directory>
            <filtering>true</filtering>
            <includes>
                <include>**/*</include>
            </includes>
        </resource>
    </resources>
</build>

And this in the ear pom.xml:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-ear-plugin</artifactId>
        </plugin>
    </plugins>
</build>
like image 261
Safwen Khalloufi Avatar asked Feb 14 '23 05:02

Safwen Khalloufi


1 Answers

Look for finalName tag under the plugin

maven-ear-plugin

  <build>
       <finalName>YourCool-Name</finalName>   
  <build>
like image 63
Eugene Avatar answered Feb 15 '23 17:02

Eugene