Showing posts with label timestamp. Show all posts
Showing posts with label timestamp. Show all posts

Monday, January 7, 2013

Changing WAR or adding time stamp to your war name for maven supported project

Changing names for a maven project can be done in one to the two ways.

Easy fix:

The war name is same as artifact ID

    <groupId>com</groupId>
    <artifactId>ABC</artifactId>
    <version>0.0.1-SNAPSHOT    </version>
    <packaging>war</packaging>


will generate ABC.WAR in target specified folder


Other way:

So in this senario I also want to attach dynamically generated timestamp to my war

We will need to install plugin to generate time stamp as we want
 
           <build>
                <finalName>
                        ${project.artifactId}-${project.version}-${timestamp}
                </finalName>
                <plugins>
                    <plugin>
                        <groupId>
                            com.keyboardsamurais.maven
                        </groupId>
                        <artifactId>
                            maven-timestamp-plugin
                        </artifactId>
                        <version>
                            1.0
                        </version>
                        <configuration>
                            <propertyName>
                                timestamp
                            </propertyName>
                            <timestampPattern>
                                    dd.MM.yyyy HH.mm
                            </timestampPattern>
                        </configuration>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>
                                        create
                                    </goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>

Should output: ABC-0.0.1-SNAPSHOT-07.01.2013 11.54.war