在EC2 Jenkins上编译项目的war文件

问题描述 投票:0回答:2

我的团队正在使用JavaEE和Angular 4,以及AWS EC2服务器,它上面有Jenkins,并配置成在成功合并到master后,构建内容并生成具有构建状态的Slack通知。然而,当我负责管理它的人进入EC2服务器检查代码时,我找不到Jenkins应该在.jenkins或其他任何地方构建的WAR文件。如何让Jenkins构建一个.war文件,我可以访问它以启动我们的RESTful API服务?

修复了pom.xml中的拼写错误后,现在看起来像这样:

<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.zenith</groupId>
    <artifactId>SHOULDi-back</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>war</packaging>

    <name>SHOULDi-back</name>

    <properties>
        <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>


    <dependencies>

        <!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
<dependency>
    <groupId>com.google.code.gson</groupId>
    <artifactId>gson</artifactId>
    <version>2.8.2</version>
</dependency>



        <dependency>
            <groupId>oracle</groupId>
            <artifactId>ojdbc7</artifactId>
            <version>12.1.0</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.glassfish.jersey.bundles/jaxrs-ri -->
        <dependency>
            <groupId>org.glassfish.jersey.bundles</groupId>
            <artifactId>jaxrs-ri</artifactId>
            <version>2.25</version>
        </dependency>



        <!-- https://mvnrepository.com/artifact/org.glassfish.jersey.media/jersey-media-moxy -->
        <dependency>
            <groupId>org.glassfish.jersey.media</groupId>
            <artifactId>jersey-media-moxy</artifactId>
            <version>2.25</version>
        </dependency>


        <!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-core -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>5.2.8.Final</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-validator -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>5.4.0.Final</version>
        </dependency>






        <!-- https://mvnrepository.com/artifact/org.springframework/spring-beans -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <version>4.3.7.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>4.3.1.Final</version>
        </dependency>
    </dependencies>
    <build>
        <finalName>SHOULDi-back</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.2</version>
            </plugin>
        </plugins>
    </build>
</project>
maven amazon-web-services jenkins amazon-ec2
2个回答
0
投票

根据您的Jenkins安装,.war可能位于/ var / lib / jenkins / workspace或其他目录中。试试find /var/lib/jenkins/workspace -name *war*吧。

要查找Jenkins主目录(如果不是上述内容),请登录服务器并运行sudo su - jenkins && pwd;如果失败,请编辑/ etc / passwd并将jenkins的用户更改为使用/ bin / bash而不是/ bin / false,然后重试。


0
投票

这个问题似乎与我的pom.xml文件没什么关系,后者有这种麻烦的依赖:

<dependency>
        <groupId>com.oracle</groupId>
        <artifactId>ojdbc7</artifactId>
        <version>12.1.0</version>
    </dependency>

,我必须废弃以使构建工作和.war文件生成。此外,我不得不调用顶级Maven目标作为构建步骤。在那里,我指定了我的pom.xml的路径。完成后,构建成功并生成.war文件。至于.war文件是否真的有用,那么,这是另一个话题。

© www.soinside.com 2019 - 2024. All rights reserved.