Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/python-2.7/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何将eclipse中我的maven项目导出到war文件_Java_Eclipse_Spring_Maven - Fatal编程技术网

Java 如何将eclipse中我的maven项目导出到war文件

Java 如何将eclipse中我的maven项目导出到war文件,java,eclipse,spring,maven,Java,Eclipse,Spring,Maven,我使用Eclipse在springs中编写web项目已经有一段时间了,但我也刚开始研究maven。我在eclipse中用maven制作了一个很好的示例web项目,但是如果我右键单击该项目,我将无法再导出到WAR文件。如何将war文件放到服务器上?我必须在pom.xml中添加一些内容吗 请帮帮我。。。。my pom.xml如下所示: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/

我使用Eclipse在springs中编写web项目已经有一段时间了,但我也刚开始研究maven。我在eclipse中用maven制作了一个很好的示例web项目,但是如果我右键单击该项目,我将无法再导出到WAR文件。如何将war文件放到服务器上?我必须在pom.xml中添加一些内容吗

请帮帮我。。。。my pom.xml如下所示:

<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>org.springsource.greenbeans.maven</groupId>
    <artifactId>WebFlowTemplate</artifactId>
    <packaging>war</packaging>
    <version>0.0.1-SNAPSHOT</version>
    <name>WebFlowTemplate Maven Webapp</name>
    <url>http://maven.apache.org</url>
    <dependencies>

        <dependency>
            <groupId>jstl</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>

        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>3.6.3.Final</version>
        </dependency>

        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>4.3.0.Final</version>
        </dependency>

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

        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjtools</artifactId>
            <version>1.6.2</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aspects</artifactId>
            <version>3.1.2.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>3.1.2.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.webflow</groupId>
            <artifactId>spring-webflow</artifactId>
            <version>2.3.1.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-core</artifactId>
            <version>3.1.2.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-web</artifactId>
            <version>3.1.2.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-config</artifactId>
            <version>3.1.2.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aop</artifactId>
            <version>3.1.2.RELEASE</version>
        </dependency>


        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>



    </dependencies>
    <build>
        <finalName>WebFlowTemplate</finalName>
    </build>
</project>

4.0.0
org.springsource.greenbeans.maven
WebFlowTemplate
战争
0.0.1-快照
WebFlowTemplate Maven Webapp
http://maven.apache.org
jstl
jstl
1.2
org.hibernate
冬眠核心
3.6.3.最终版本
org.hibernate
休眠验证器
4.3.0.1最终版本
朱尼特
朱尼特
3.8.1
测试
org.aspectj
aspectjtools
1.6.2
org.springframework
春季方面
3.1.2.1发布
org.springframework
spring上下文
3.1.2.1发布
org.springframework.webflow
SpringWebFlow
2.3.1.1发布
org.springframework.security
spring安全内核
3.1.2.1发布
org.springframework.security
spring安全网
3.1.2.1发布
org.springframework.security
spring安全配置
3.1.2.1发布
org.springframework
春季aop
3.1.2.1发布
log4j
log4j
1.2.17
WebFlowTemplate

使用maven插件maven编译器插件,maven war插件,例如:

<build>
    <plugins>
        ...
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.0.2</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
                <encoding>${project.build.sourceEncoding}</encoding>
                <showWarnings>true</showWarnings>
                <showDeprecation>true</showDeprecation>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.1-beta-1</version>
            <configuration>
                <failOnMissingWebXml>false</failOnMissingWebXml>
                <webappDirectory>${project.build.directory}/${project.artifactId}</webappDirectory>
                <warName>${project.artifactId}_${noVer}</warName>
                <archive>
                    <addMavenDescriptor>false</addMavenDescriptor>
                    <manifest>
                        <addClasspath>false</addClasspath>
                    </manifest>
                    <manifestEntries/>
                    <manifestFile/>
                </archive>
            </configuration>
        </plugin>
        ...
    </plugins>
    <finalName>${project.artifactId}-${project.version}</finalName>
</build>
将创建WAR文件


您可以从eclipse运行配置中执行mvn安装目标…

您可以共享“mvn包”运行的输出吗?嗯。。。我说的是在Eclipse中,我曾经有一个选项,可以右键单击并导出到WAR
mvn install