有没有在Eclipse 3.4中导出WAR文件的快捷方法?

时间:2022-05-12 23:13:11

I know about the export->war file

我知道export-> war文件

I would like something similar to the .jardesc that allows you to define the destination. So I could right-click on that .jardesc and do export. Except .wardesc instead of .jardesc :)

我想要类似于.jardesc的东西,它允许你定义目的地。所以我可以右键单击.jardesc然后导出。除了.wardesc而不是.jardesc :)

Is the war export functionality tied to an eclipse ant task?

战争导出功能是否与eclipse ant任务相关联?

I've put together an AHK macro so it will do the GUI motions for me... but that's a hack not a solution.

我已经把一个AHK宏放在一起,所以它会为我做GUI动作......但这是一个黑客而不是解决方案。

5 个解决方案

#1


Eclipse has the notion of external commands. If you can write e.g. an ant script that does the export the way you like it you can start it from the menu/button. For ant scripts you can also pick the ant target you want to call and pass properties. This allows you to edit e.g. the path name in the Launch Configuration.

Eclipse具有外部命令的概念。如果你可以写,例如一个蚂蚁脚本,按您喜欢的方式导出,您可以从菜单/按钮启动它。对于ant脚本,您还可以选择要调用的ant目标并传递属性。这允许您编辑,例如启动配置中的路径名称。

#2


Is the war export functionality tied to an eclipse ant task?

战争导出功能是否与eclipse ant任务相关联?

As far as I know, yes. You might try searching for a plugin that can do this for you; I found a couple, such as the war-plugin builder, but I haven't tried it myself, as I try to avoid using extra plugins in eclipse.

据我所知,是的。您可以尝试搜索可以为您执行此操作的插件;我找到了一对,比如war-plugin builder,但我自己没有尝试过,因为我试图避免在eclipse中使用额外的插件。

#3


Theres the Ant WAR task.

这是Ant WAR任务。

#4


The right way to do "war export" is to use a build system (like Maven) and let it do the heavy lifting. All you need is a pom.xml with <packaging>war</packaging>.

做“战争出口”的正确方法是使用构建系统(如Maven)并让它完成繁重的工作。您只需要一个带 war 的pom.xml。

Eclipse's exports are meant for occasional exports by humans, not for automation. And if you would really like to automate, do it right. You will benefit from other things, too. The same pom file will run on your machine, on other developers' machines and on your build server.

Eclipse的出口意味着人类偶尔出口,而非自动化出口。如果你真的想自动化,那就做对了。您也将受益于其他事物。同一个pom文件将在您的计算机,其他开发人员的计算机和构建服务器上运行。

#5


WAR ant task

WAR蚂蚁任务

http://ant.apache.org/manual/Tasks/war.html

from the documentation:

从文件:

Assume the following structure in the project's base directory:

假设项目的基目录中有以下结构:

thirdparty/libs/jdbc1.jar
thirdparty/libs/jdbc2.jar
build/main/com/myco/myapp/Servlet.class
src/metadata/myapp.xml
src/html/myapp/index.html
src/jsp/myapp/front.jsp
src/graphics/images/gifs/small/logo.gif
src/graphics/images/gifs/large/logo.gif

then the war file myapp.war created with

然后战争文件myapp.war创建了

<war destfile="myapp.war" webxml="src/metadata/myapp.xml">
  <fileset dir="src/html/myapp"/>
  <fileset dir="src/jsp/myapp"/>
  <lib dir="thirdparty/libs">
    <exclude name="jdbc1.jar"/>
  </lib>
  <classes dir="build/main"/>
  <zipfileset dir="src/graphics/images/gifs"
              prefix="images"/>
</war>

will consist of

将包括

WEB-INF/web.xml
WEB-INF/lib/jdbc2.jar
WEB-INF/classes/com/myco/myapp/Servlet.class
META-INF/MANIFEST.MF
index.html
front.jsp
images/small/logo.gif
images/large/logo.gif

#1


Eclipse has the notion of external commands. If you can write e.g. an ant script that does the export the way you like it you can start it from the menu/button. For ant scripts you can also pick the ant target you want to call and pass properties. This allows you to edit e.g. the path name in the Launch Configuration.

Eclipse具有外部命令的概念。如果你可以写,例如一个蚂蚁脚本,按您喜欢的方式导出,您可以从菜单/按钮启动它。对于ant脚本,您还可以选择要调用的ant目标并传递属性。这允许您编辑,例如启动配置中的路径名称。

#2


Is the war export functionality tied to an eclipse ant task?

战争导出功能是否与eclipse ant任务相关联?

As far as I know, yes. You might try searching for a plugin that can do this for you; I found a couple, such as the war-plugin builder, but I haven't tried it myself, as I try to avoid using extra plugins in eclipse.

据我所知,是的。您可以尝试搜索可以为您执行此操作的插件;我找到了一对,比如war-plugin builder,但我自己没有尝试过,因为我试图避免在eclipse中使用额外的插件。

#3


Theres the Ant WAR task.

这是Ant WAR任务。

#4


The right way to do "war export" is to use a build system (like Maven) and let it do the heavy lifting. All you need is a pom.xml with <packaging>war</packaging>.

做“战争出口”的正确方法是使用构建系统(如Maven)并让它完成繁重的工作。您只需要一个带 war 的pom.xml。

Eclipse's exports are meant for occasional exports by humans, not for automation. And if you would really like to automate, do it right. You will benefit from other things, too. The same pom file will run on your machine, on other developers' machines and on your build server.

Eclipse的出口意味着人类偶尔出口,而非自动化出口。如果你真的想自动化,那就做对了。您也将受益于其他事物。同一个pom文件将在您的计算机,其他开发人员的计算机和构建服务器上运行。

#5


WAR ant task

WAR蚂蚁任务

http://ant.apache.org/manual/Tasks/war.html

from the documentation:

从文件:

Assume the following structure in the project's base directory:

假设项目的基目录中有以下结构:

thirdparty/libs/jdbc1.jar
thirdparty/libs/jdbc2.jar
build/main/com/myco/myapp/Servlet.class
src/metadata/myapp.xml
src/html/myapp/index.html
src/jsp/myapp/front.jsp
src/graphics/images/gifs/small/logo.gif
src/graphics/images/gifs/large/logo.gif

then the war file myapp.war created with

然后战争文件myapp.war创建了

<war destfile="myapp.war" webxml="src/metadata/myapp.xml">
  <fileset dir="src/html/myapp"/>
  <fileset dir="src/jsp/myapp"/>
  <lib dir="thirdparty/libs">
    <exclude name="jdbc1.jar"/>
  </lib>
  <classes dir="build/main"/>
  <zipfileset dir="src/graphics/images/gifs"
              prefix="images"/>
</war>

will consist of

将包括

WEB-INF/web.xml
WEB-INF/lib/jdbc2.jar
WEB-INF/classes/com/myco/myapp/Servlet.class
META-INF/MANIFEST.MF
index.html
front.jsp
images/small/logo.gif
images/large/logo.gif