Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ community can't find Web Application Artifact to generate WAR

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?

like image 259
Alex Mawashi Avatar asked Nov 07 '16 15:11

Alex Mawashi


People also ask

How do I add war artifacts in IntelliJ?

Click Artifacts to open the Artifacts page. Do one of the following: To use a pre-defined exploded directory artifact, select the <module name>war:exploded artifact from the list on the left-hand pane. If necessary, change the name and output directory of the artifact in the corresponding fields on the right-hand pane.

How do I create a war file in IntelliJ Community Edition?

Build a WAR artifact After IntelliJ IDEA creates the new project, build a WAR artifact to deploy to the application server. From the main menu, select Build | Build Artifacts. In the Build Artifact dialog, select to build the DockerJavaWebApp:war artifact.

Can we develop web application in IntelliJ Community Edition?

With IntelliJ IDEA, you can have the basic application structure automatically set up according to the required standard and get extensive coding assistance at all the stages of Web application development.

Where is the .WAR file?

The location for WAR files is the webapps directory within your Tomcat installation directory.


2 Answers

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.

like image 165
Birchlabs Avatar answered Sep 19 '22 13:09

Birchlabs


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!

like image 21
Nano Avatar answered Sep 18 '22 13:09

Nano