Koray Tugay
Koray Tugay

Reputation: 23800

How to tell IntelliJ to use folder "web" instead of "webapp" for maven when building a war file?

What I do is:

  1. Create a new project with IntelliJ with Maven module.
  2. Add Framework support to this project and pick: JSF.
  3. Go to pom.xml and add: packaging: war.
  4. And from Maven window in IntelliJ I click: Clean Install.

Well build fails, because maven is looking for a webapp directory instead of a directory called web. For building the project.

So, if I rename the folder web to webapp build goes fine.

However, I want to learn more about IntelliJ and maven, so I want to force maven to use the folder web. How can I properly do this

Regards.

Upvotes: 1

Views: 3263

Answers (2)

Bastien Jansen
Bastien Jansen

Reputation: 8846

Have a look at this post, which explains how to change the default webapp directory:

<build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.3</version>
        <configuration>
          <warSourceDirectory>web</warSourceDirectory>
        </configuration>
      </plugin>
    </plugins>
</build>

Upvotes: 4

NilsH
NilsH

Reputation: 13821

You can configure this in the pom.xml file for your project.

<plugins>
  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <configuration>
      <warSourceDirectory>web</warSourceDirectory>
    </configuration>
  </plugin>
</plugins>

You can find the documentation here

If IntelliJ behaves as expected, it should pick up this new configuration.

Upvotes: 6

Related Questions