jenkins helper

This project interfaces with JUnit Attachments Plugin to record and display files easily in Jenkins deploy with instructions from https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide mvn -s settings.xml -DperformRelease=true clean deploy you will want to make a local settings file so your deployment does not no conflict with safari's internal maven settings, the "-s settings.xml" part of the command

License

License

Categories

Categories

Java Languages Jenkins Build Tools Continuous Integration and Continuous Delivery
GroupId

GroupId

com.safaribooks
ArtifactId

ArtifactId

jenkins-helper-java
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

jenkins helper
This project interfaces with JUnit Attachments Plugin to record and display files easily in Jenkins deploy with instructions from https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide mvn -s settings.xml -DperformRelease=true clean deploy you will want to make a local settings file so your deployment does not no conflict with safari's internal maven settings, the "-s settings.xml" part of the command
Project URL

Project URL

https://github.com/safarijv/jenkins-helper-java
Source Code Management

Source Code Management

https://github.com/safarijv/jenkins-helper-java

Download jenkins-helper-java

How to add to project

<!-- https://jarcasting.com/artifacts/com.safaribooks/jenkins-helper-java/ -->
<dependency>
    <groupId>com.safaribooks</groupId>
    <artifactId>jenkins-helper-java</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.safaribooks/jenkins-helper-java/
implementation 'com.safaribooks:jenkins-helper-java:1.0.0'
// https://jarcasting.com/artifacts/com.safaribooks/jenkins-helper-java/
implementation ("com.safaribooks:jenkins-helper-java:1.0.0")
'com.safaribooks:jenkins-helper-java:jar:1.0.0'
<dependency org="com.safaribooks" name="jenkins-helper-java" rev="1.0.0">
  <artifact name="jenkins-helper-java" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.safaribooks', module='jenkins-helper-java', version='1.0.0')
)
libraryDependencies += "com.safaribooks" % "jenkins-helper-java" % "1.0.0"
[com.safaribooks/jenkins-helper-java "1.0.0"]

Dependencies

compile (2)

Group / Artifact Type Version
junit : junit jar 4.11
commons-io : commons-io jar 2.4

Project Modules

There are no modules declared in this project.

jenkins-helper-java

This project interfaces with JUnit Attachments Plugin to record and display files easily in Jenkins.

For more information read our blog post

Configure Jenkins

To use the Jenkins helper first configure you Jenkins instance to use the JUnit Attachments Plugin

  • go to [jenkins]/pluginManager/ where jenkins is your jenkins url
  • Click on under the Available tab select JUnit Attachments Plugin
  • click Download now and install after restart
  • You will need to restart Jenkins.

Then configure your Jenkins build to use the Plugin.

  • Click the Configure link in your project
  • Under Post-build Actions
  • “Add post-build action” and add Archive the artifacts if you have not already
  • next to Files to archive put target/test-attachments/**
  • Again if you have not already added Publish JUnit test result report add it with Add post-build action
  • Select the Publish test attachments check-box.

Configure Maven

Include jenkins-helper-java in your pom as a test dependency

<dependency>
    <groupId>com.safaribooks</groupId>
    <artifactId>jenkins-helper-java</artifactId>
    <version>1.0.0</version>
    <scope>test</scope>
</dependency>

Configuring your tests

You will need to include RecordAttachmentRule as a rule in your junit test

    @Rule
    public RecordAttachmentRule recordArtifactRule = new RecordAttachmentRule(this);

Then annotate public fields or methods you would like recorded on test failure

    @CaptureFile(extension = "txt")
    public String impotantText;

    @CaptureFile(extension = "xml")
    public String getImportantXml() {
        return getXml()
    }

The interface is simple, artifacts will only be recorded on test failure, and nothing will be recorded if they are null.

Versions

Version
1.0.0