如何在NetBeans中创建项目的war文件?

时间:2023-01-13 10:58:54

How can I create a war file of my project in NetBeans?

如何在NetBeans中创建项目的war文件?

10 个解决方案

#1


46  

It's possible that you already have a war file and don't know it - netbeans does most of the work for you and I believe it creates a distributable war file by default. If you created a web project and successfully built it, it will be in the "dist" directory off your project root.

您可能已经有了一个war文件,并且不知道它——netbeans为您做了大部分工作,我相信它在默认情况下创建了一个可分配的war文件。如果您创建了一个web项目并成功构建了它,那么它将位于项目根目录下的“dist”目录中。

#2


27  

As DPA says, the easiest way to generate a war file of your project is through the IDE. Open the Files tab from your left hand panel, right click on the build.xml file and tell it what type of ant target you want to run.

正如DPA所说,生成项目的war文件的最简单方法是通过IDE。从你的左手面板打开文件标签,右键点击构建。xml文件,告诉它您想要运行的ant目标类型。

如何在NetBeans中创建项目的war文件?

#3


17  

Right click your project, hit "Clean and Build". Netbeans does the rest.

右键单击项目,点击“Clean and Build”。Netbeans的休息。

under the dist directory of your app, you should find a pretty looking .war all ready for deployment.

在你的应用程序的dist目录下,你应该能找到一个漂亮的。

#4


5  

Netbeans will create the Ant script for you, it uses Ant to build anyway. But if you want to get the war file, just build your project. The .war file will be located in /yournetbeanshomedirectory/yourproject/dist/yourwar.war

Netbeans将为您创建Ant脚本,它使用Ant构建。但是如果你想获得war文件,只需构建你的项目。war文件将位于/yournetbeanshomedirectory/yourproject/dist/yourwar.war。

You can check out the ant build script it uses by looking at the build.xml file in your project directory. Might help you feel a little more comfortable using ant to do builds.

您可以通过查看构建来查看ant构建脚本。项目目录中的xml文件。使用ant构建版本可能会让您感觉更舒服。

#5


2  

I had to right-click the build.xml file and choose "run". Only then would the .war file be created.

我必须右键单击构建。xml文件并选择“run”。只有这样,.war文件才会被创建。

#6


2  

If NetBeans haven't created your dist folder, execute the do-dist ant target:

如果NetBeans没有创建您的dist文件夹,则执行do-dist ant目标:

In commandline navigate to the directory of your project, the one containing a build.xml file
> ant do-dist

If ant runs fine (most likely), your dist folder will be created, containing the .war file.

如果ant运行良好(很可能),将创建您的dist文件夹,其中包含.war文件。

#7


1  

This worked for me:

这工作对我来说:

1.Right click pom.xml
2.Run Maven > Goals
3.Edit maven goals

1。右击砰的一声。xml 2。运行Maven >目标3。编辑maven目标

如何在NetBeans中创建项目的war文件?


如何在NetBeans中创建项目的war文件?

Results: war build in /target folder

结果:战争建立在/目标文件夹。

   Packaging webapp
    Assembling webapp [WeatherDashboard] in [C:\Users\julian.mojico\Documents\NetBeansProjects\WeatherDashboard\target\WeatherDashboard-1.0-SNAPSHOT]
    Processing war project
    Webapp assembled in [672 msecs]
    Building war: C:\Users\julian.mojico\Documents\NetBeansProjects\WeatherDashboard\target\WeatherDashboard-1.0-SNAPSHOT.war
    ------------------------------------------------------------------------
    BUILD SUCCESS
    ------------------------------------------------------------------------
    Total time: 1:41.633s
    Finished at: Tue Sep 05 09:41:27 ART 2017
    Final Memory: 18M/97M
    ------------------------------------------------------------------------

#8


0  

Just check in you projects properties >build ->packaging WAR file compress.

只要检查一下您的项目属性>构建->包装WAR文件压缩。

#9


0  

Simplest way is to Check the Output - Build tab: It would display the location of war file.
It will have something like:

最简单的方法是检查Output - Build选项卡:它将显示war文件的位置。它会有:

Installing D:\Project\target\Tool.war to C:\Users\myname.m2\repository\com\tool\1.0\Tool-1.0.war

目标项目安装D:\ \ \工具。战争C:\Users\myname.m2\repository\com\tool\1.0\ Tool-1.0.war

#10


0  

It is in the dist folder inside of the project, but only if "Compress WAR File" in the project settings dialog ( build / packaging) ist checked. Before I checked this checkbox there was no dist folder.

它是在项目内部的dist文件夹中,但只有在项目设置对话框(构建/打包)中“压缩WAR文件”时才进行检查。在我检查这个复选框之前,没有dist文件夹。

#1


46  

It's possible that you already have a war file and don't know it - netbeans does most of the work for you and I believe it creates a distributable war file by default. If you created a web project and successfully built it, it will be in the "dist" directory off your project root.

您可能已经有了一个war文件,并且不知道它——netbeans为您做了大部分工作,我相信它在默认情况下创建了一个可分配的war文件。如果您创建了一个web项目并成功构建了它,那么它将位于项目根目录下的“dist”目录中。

#2


27  

As DPA says, the easiest way to generate a war file of your project is through the IDE. Open the Files tab from your left hand panel, right click on the build.xml file and tell it what type of ant target you want to run.

正如DPA所说,生成项目的war文件的最简单方法是通过IDE。从你的左手面板打开文件标签,右键点击构建。xml文件,告诉它您想要运行的ant目标类型。

如何在NetBeans中创建项目的war文件?

#3


17  

Right click your project, hit "Clean and Build". Netbeans does the rest.

右键单击项目,点击“Clean and Build”。Netbeans的休息。

under the dist directory of your app, you should find a pretty looking .war all ready for deployment.

在你的应用程序的dist目录下,你应该能找到一个漂亮的。

#4


5  

Netbeans will create the Ant script for you, it uses Ant to build anyway. But if you want to get the war file, just build your project. The .war file will be located in /yournetbeanshomedirectory/yourproject/dist/yourwar.war

Netbeans将为您创建Ant脚本,它使用Ant构建。但是如果你想获得war文件,只需构建你的项目。war文件将位于/yournetbeanshomedirectory/yourproject/dist/yourwar.war。

You can check out the ant build script it uses by looking at the build.xml file in your project directory. Might help you feel a little more comfortable using ant to do builds.

您可以通过查看构建来查看ant构建脚本。项目目录中的xml文件。使用ant构建版本可能会让您感觉更舒服。

#5


2  

I had to right-click the build.xml file and choose "run". Only then would the .war file be created.

我必须右键单击构建。xml文件并选择“run”。只有这样,.war文件才会被创建。

#6


2  

If NetBeans haven't created your dist folder, execute the do-dist ant target:

如果NetBeans没有创建您的dist文件夹,则执行do-dist ant目标:

In commandline navigate to the directory of your project, the one containing a build.xml file
> ant do-dist

If ant runs fine (most likely), your dist folder will be created, containing the .war file.

如果ant运行良好(很可能),将创建您的dist文件夹,其中包含.war文件。

#7


1  

This worked for me:

这工作对我来说:

1.Right click pom.xml
2.Run Maven > Goals
3.Edit maven goals

1。右击砰的一声。xml 2。运行Maven >目标3。编辑maven目标

如何在NetBeans中创建项目的war文件?


如何在NetBeans中创建项目的war文件?

Results: war build in /target folder

结果:战争建立在/目标文件夹。

   Packaging webapp
    Assembling webapp [WeatherDashboard] in [C:\Users\julian.mojico\Documents\NetBeansProjects\WeatherDashboard\target\WeatherDashboard-1.0-SNAPSHOT]
    Processing war project
    Webapp assembled in [672 msecs]
    Building war: C:\Users\julian.mojico\Documents\NetBeansProjects\WeatherDashboard\target\WeatherDashboard-1.0-SNAPSHOT.war
    ------------------------------------------------------------------------
    BUILD SUCCESS
    ------------------------------------------------------------------------
    Total time: 1:41.633s
    Finished at: Tue Sep 05 09:41:27 ART 2017
    Final Memory: 18M/97M
    ------------------------------------------------------------------------

#8


0  

Just check in you projects properties >build ->packaging WAR file compress.

只要检查一下您的项目属性>构建->包装WAR文件压缩。

#9


0  

Simplest way is to Check the Output - Build tab: It would display the location of war file.
It will have something like:

最简单的方法是检查Output - Build选项卡:它将显示war文件的位置。它会有:

Installing D:\Project\target\Tool.war to C:\Users\myname.m2\repository\com\tool\1.0\Tool-1.0.war

目标项目安装D:\ \ \工具。战争C:\Users\myname.m2\repository\com\tool\1.0\ Tool-1.0.war

#10


0  

It is in the dist folder inside of the project, but only if "Compress WAR File" in the project settings dialog ( build / packaging) ist checked. Before I checked this checkbox there was no dist folder.

它是在项目内部的dist文件夹中,但只有在项目设置对话框(构建/打包)中“压缩WAR文件”时才进行检查。在我检查这个复选框之前,没有dist文件夹。