4
votes

I am attempting to configure the following workflow pattern in Jenkins:

  1. Build WAR File & Publish to Artifactory
  2. Deploy WAR File from Artifactory to DEV & Publish to Artifactory Repo for Dev
  3. Deploy WAR File from DEV to QA & Publish to Artifactory Repo for QA
  4. {QA to Regression and so on}

I seem to be missing something. The components of the application (jar files, etc.) appear to get deployed to Artifactory just fine in the target releases/snapshots directories. However, the final WAR artifact doesn't seem to get stored in Artifactory despite Jenkins clearly identifying the artifact was successfully built.

I'm using the standard targets: clean install. I have also attempted (with no change): clean install repackage

I have the standard Artifactory plugin for Jenkins installed.

I have checked the following configurations for the first Jenkins Job to build the project and publish it to Artifactory:

PRE-BUILD & BUILD

  • Discard Old Builds (keep 5)
  • Permission to copy artifacts
  • git (with requisite credentials which work properly)
  • Enable Artifactory Release Management (One version for all modules)
  • Build uses a POM and the "clean" and "install" options.

POST-BUILD

  • Archive the artifacts (**/*.war)
  • Deploy artifacts to Artifactory (release and snapshot directories exist and seem to work fine, and are loaded from the Artifactory server properly when I click refresh)
  • Capture & Publish Build Info
  • Include Environment Variables (only the defaults configured)

An editable email notification post-build step is also included.

I can use these same options and they will successfully deploy the final WAR file to a Tomcat instance without issue. Jenkins also holds on to the WAR file based on configuration. But Artifactory seems to store the components instead of the final WAR file.

I've been playing with config options and coming up blank for too long. Any and all help is appreciated.

EDIT: Here is a snippit from the POM file used for the "clean install" target when building the war file.

<build>
    <defaultGoal>clean install</defaultGoal>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.18.1</version>
            <configuration>
                <includes>
                    <include>**/*Tests.java</include>
                    <include>**/*Test.java</include>
                    <include>**/Test*.java</include>
                </includes>
                <skipTests>true</skipTests>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>${maven.compiler.plugin.version}</version>
            <configuration>
                <source>${java.version}</source>
                <target>${java.version}</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>${maven.war.plugin.version}</version>
            <configuration>
                <failOnMissingWebXml>false</failOnMissingWebXml>
                <archive>
                    <addMavenDescriptor>false</addMavenDescriptor>
                    <manifestEntries>
                        <Implementation-Version>${project.version}</Implementation-Version>
                        <Implementation-Revision>${git.revision}</Implementation-Revision>
                        <X-Git-Commits-Count>${git.commitsCount}</X-Git-Commits-Count>
                    </manifestEntries>
                </archive>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-release-plugin</artifactId>
            <configuration>
                <autoVersionSubmodules>true</autoVersionSubmodules>
            </configuration>
        </plugin>
    </plugins>
</build>
1
Are you building the war using the Maven war plugin? does it have a separate Maven module for the war? do you see it in the build info? Have you seen the project example?Dror Bereznitsky
Both the Maven Integration Plugin and Maven Project Plugin are installed, active and up to date. The application builds fine and produces a single war file: appName.war. That war file is copied to a Tomcat instance and works properly including QA testing. However, when publishing to Artifactory, it doesn't store the war file, but rather the components of the war file, which would be fine if I wanted it to do code snapshots instead of artifact snapshots.Chris Giddings
I suspect the problem is related to the Maven project, so I was asking regarding Maven plugins being used (not Jenkins plugins). It looks like the Artifactory Jenkins plugin fails to identify the web moduleDror Bereznitsky
The maven war plugin is being used.Chris Giddings
I tried to post to section from the POM but the comment is too long. Here's where it's called: ` <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId>`Chris Giddings

1 Answers

1
votes

It seems that the War file is the second artefact of your Maven project.

Can you have a look here and tell us if it solves your issue? Maven deploy secondary file to repository