Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8528317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T08:46:28+00:00 2026-06-11T08:46:28+00:00

I have a Maven project that generates a WAR file and tries to get

  • 0

I have a Maven project that generates a WAR file and tries to get the artifact version from properties in .properties files that are maintained in the codebase. I also try to form the final name of the WAR file using custom properties.

Snippet :

<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.xyz.webapps</groupId>
  <artifactId>webapps</artifactId>
  <version>${info.version}-${application.env}</version>
  <packaging>war</packaging>
  <!-- Filling in the artifact version with properties read below -->

   ...

  <!-- Filling in the WAR name -->
   <properties>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     <maven.war.final.name>${pom.artifactId}-${pom.currentVersion}.war</maven.war.final.name>
     <maven.test.skip>true</maven.test.skip>
   </properties>

 ...

 <build>
   <plugins>

   ...

   <!-- I read those properties files here -->
   <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>properties-maven-plugin</artifactId>
    <version>1.0-alpha-2</version>
    <executions>
      <execution>
        <phase>validate</phase>
        <goals>
          <goal>read-project-properties</goal>
        </goals>
        <configuration>
          <files>
            <file>${project.basedir}/webapps-main/src/main/resources/MessageResources.properties</file>
            <file>${project.basedir}/build.properties</file>
          </files>
        </configuration>
      </execution>
    </executions>
  </plugin>

  ...

 </plugins>

...
</project>

The name of the WAR file gets generated properly when I do a “mvn clean package” :

[INFO] Assembling webapp[webapps] in [/home/jubuntu/workspace/ui/new/webapps/target/webapps-2.8-qa]
[INFO] Processing war project
[INFO] Copying webapp resources[/home/jubuntu/workspace/ui/new/webapps/webapps-main/src/main/webapp]
[INFO] Webapp assembled in [4690 msecs]
[INFO] Building war: /home/jubuntu/workspace/ui/new/webapps/target/webapps-2.8-qa.war

But when I do a “mvn clean install” ( or a “mvn clean deploy” ) , the properties don’t expand for some reason (the package phase still generates the WAR with the right name) :

[INFO] Building war: /home/jubuntu/workspace/ui/new/webapps/target/webapps-2.8-qa.war
[INFO] [install:install {execution: default-install}]
[INFO] Installing /home/jubuntu/workspace/ui/new/webapps/target/webapps-2.8-qa.war to /home/jubuntu/.m2/repository/com/xyz/webapps/webapps/${info.version}-${application.env}/webapps-${info.version}-${application.env}.war

Is there something wrong that I’m doing here ? How would I make this work for installing and deploying my artifact ? I use maven version 2.2.1 for my builds. Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T08:46:29+00:00Added an answer on June 11, 2026 at 8:46 am

    You can’t do this. It’s not supported by Maven. It’s fundamental.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently I have a simple maven project that is building a jar file and
I have a Maven project which generates a 413.06 KB jar file. I have
I have a war packaging Maven project, in which I have a Java properties
i have a Maven 2 project setup which nicely packages a war file using
I have been trying to convert a web project that produces a war file
We have a few maven projects that inherit from eachother. Our persistence layer project's
I have a JCEKS keystore that I am loading from a war file as
I have a maven project which uses wsgen to generate XSD files from the
I have a maven project that was generated by Spring Roo. Now I am
I have a maven project that contains a certain api I need to use

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.