10

I'm using IntelliJ-IDEA Community Edition to generate a war file from a Maven-Project.

When it comes to generate this war file I can't find the war option among the artifacts.

I've tried to:

1) go to File>Project Structure>Artifacts>Type, but WAR is not mentioned;

2) right click on Project Module > add Framework Support, but Web Application is not mentioned (I only have Groovy, Kotlin(Java), Kotlin (JavaScript).

This is my pom.xml file:

    <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/maven-v4_0_0.xsd">
      <modelVersion>4.0.0</modelVersion>
      <groupId>mawashi.alex.firstapp</groupId>
      <artifactId>firstapp</artifactId>
      <packaging>war</packaging>
      <version>1.0-SNAPSHOT</version>
      <name>firstapp</name>
      <url>http://maven.apache.org</url>
  <parent>
     <groupId>org.springframework.boot</groupId>
     <artifactId>spring-boot-starter-parent</artifactId>
     <version>1.2.7.RELEASE</version>
  </parent>
  <properties>
     <java.version>1.8</java.version>
  </properties>

  <dependencies>
    <!--automatic configuration for web applications-->
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-tomcat</artifactId>
      <version>1.4.1.RELEASE</version>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugins</artifactId>
      </plugin>
    </plugins>
  </build>

  <repositories>
    <repository>
      <id>spring-milestone</id>
      <url>https://repo.spring.io/libs-release</url>
    </repository>
    <repository>
      <id>sonatype-snapshots</id>
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>
  </repositories>

  <pluginRepositories>
    <pluginRepository>
      <id>spring-milestone</id>
      <url>https://repo.spring.io/libs-release</url>
    </pluginRepository>
    <pluginRepository>
      <id>jetty</id>
      <url>http://mvnrepository.com/artifact/org.eclipse.jetty</url>
    </pluginRepository>
  </pluginRepositories>

</project>

enter image description here

How can I move forward?

Alessandro Argentieri
  • 2,901
  • 3
  • 32
  • 62
  • Which build would you like to use? Can you tell us more about your pom.xml? Have you set a maven plugin or something? – Nano Nov 07 '16 at 15:56

2 Answers2

13

You are looking in the correct place (File>Project Structure>Artifacts), but this is not a feature of IntelliJ IDEA Community Edition.

Here's what Artifacts looks like in Ultimate Edition: Ultimate edition

Whereas — when I open the same project using Community Edition: Community edition

You are going to have to use Maven package directly:

Maven package

This will output an artefact to your target folder.

Birchlabs
  • 7,437
  • 5
  • 35
  • 54
7

Try this:

  • On the top right of the IntelliJ window search Maven Project
  • Select the build you like in the lifecycle tab

Hope this is the solution you were looking for!

Nano
  • 814
  • 2
  • 13
  • 30
  • I've posted a picture, if you can watch it! Thank you so much for your effort. I still have problems, not finding the war artifact and also on the unknown plugin of the springboot (as you can see on the image). – Alessandro Argentieri Nov 07 '16 at 16:19
  • Double click on package and the war should be generated (in the target folder, I guess) – Nano Nov 07 '16 at 16:40