bit-question
bit-question

Reputation: 3843

"Module name is invalid" when exporting an existing eclipse project to a war file

I am trying to export an existing Eclipse project to a war file. But whatever I typed in the "WAR Export" dialog page, the system always returned "Module name is invalid". I do not know how to fix this issue. Thanks for the help.

Upvotes: 28

Views: 72454

Answers (8)

user15038721
user15038721

Reputation: 21

Right-click on folder project. Click on properties. Go to project facets. Choose your Java 1.8 Scroll down to Configuration and mark Dynamic Web Module.

When I follow this step getting me the error (Dynamic Web Module 3.0 java 1.6 or newer)

I'm currently using Java 11

Upvotes: 1

Shadyar
Shadyar

Reputation: 845

If your project is a Maven project. In Export Wizard, Module name combo box will be empty and any inputs will be invalid.
Solution: If you build the project using Maven. - In project / package view Open context menu on the project > Run > Maven Build
The WAR file will be packaged in target directory.
Note: PUM file of the project should be configured for packaging WAR file.

Upvotes: 1

YoussefDir
YoussefDir

Reputation: 287

When I converted my java project onto dynamic web project using eclipse for EE developers, I encountered this. Then I made a whole new dynamic web project and copied all my source files to it, and I was able to export a war file easily.

Upvotes: 0

Oleg Kranga
Oleg Kranga

Reputation: 81

In Eclipse STS

  1. Right-click on folder project.
  2. Click on properties.
  3. Go to project facets.
  4. Choose your Java 1.8
  5. Scroll down to Configuration and mark Dynamic Web Module.

After that, it works fine.

Upvotes: 8

I am not sure about the exact cause. But this gets resolved most of the times if you give the exporting project war file name just same as the project name in the IDE

Upvotes: 0

Kishore Vignesh
Kishore Vignesh

Reputation: 141

In my case error went off when the war file name matched the project name of the eclipse. Its easy to choose one from the drop down box.

enter image description here

Upvotes: 3

Aneurysmo
Aneurysmo

Reputation: 313

I had the same issue, and I fixed it. Please follow the steps below, and you can create your war file.

  1. Right-click on folder project.
  2. Click on properties.
  3. Go to project facets.
  4. Activate, if necessary.
  5. Scroll down to Configuration and mark Dynamic Web Module.

This works for me.

Upvotes: 21

Lucas
Lucas

Reputation: 949

you must be sure your project is a Web Project, if it's not a Web Project check this link: http://eclipse.dzone.com/tips/converting-java-project-dynami

Upvotes: 8

Related Questions