Alex
Alex

Reputation: 2013

Maven war plugin ignores .properties file

I have a simple project with maven using the maven war plugin. When I clean the project and run mvn package the conf.properties file I have is always left out of my war file.

The conf.properties file is located at src/main/java/conf/conf.properties.

Any ideas on why this file is ignored?

Thanks in advance

Upvotes: 8

Views: 10060

Answers (4)

Rakesh Chauhan
Rakesh Chauhan

Reputation: 342

At war plugin level you can define encoding as shown below:

           <plugin>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.2</version>
            <configuration>
                <encoding>ISO-8859-1</encoding>
                       .........
            </configuration>
          </plugin>

Upvotes: 0

user1483443
user1483443

Reputation: 264

Add this follow in the pom.xml file:

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

Upvotes: -3

Raghuram
Raghuram

Reputation: 52665

In case you are unable to change the location of the properties file, you can add something like the following in your pom to indicate the alternate location. Refer to this as well.

<resources>
  <resource>  
    <directory>${basedir}/src/main/java/conf</directory>
  </resource>
</resources>

Upvotes: 10

billygoat
billygoat

Reputation: 21984

if you want to package your property files, put your property files in src/main/resources. This is the generic location for property files for all maven builds.

Upvotes: 17

Related Questions