GithubHelp home page GithubHelp logo

bhargavjulaganti / java-circleci Goto Github PK

View Code? Open in Web Editor NEW

This project forked from yuukiyo/java-circleci

0.0 2.0 0.0 2.82 MB

Sample Java project for getting started with CircleCI, Maven, Unlimited JCE and Bouncy Castle

License: MIT License

Java 100.00%

java-circleci's Introduction

Java on CircleCI with Bouncy Castle and JCE Unlimited

Build Status

Circle CI

About

CircleCI (http://circleci.com) is a powerful online Continuous Integration (CI) tool that provides a shared CI environment for just about any modern software project. With simple management and configuration, CircleCI can automatically figure out how to build your applications in many cases. However, in some instances you need to run some extra configuration.

This is a simple Java configuration that shows how you can get the Bouncy Castle and JCE Unlimited policy files set up on CircleCI for your JVM-based project. The basic concept is that you lay out an overlay file structure and drop it on top of the Java SDK/JRE provided by CircleCI by default. That's it! There's nothing to it!

Instructions

Basics

  1. Setup your basic project (Gradle, Maven, whatever)
  2. Create a .jdk-overlay with all the files you want installed on top of the existing JDK
  3. Create a new circle.yml file similar to what is in this project
  4. Commit
  5. Wait for the build to complete
  6. ...
  7. Profit

Detailed Explanation

1. Setup Your Project

This should not be anything new. I really don't care what build library you are using nor do I care if you are using Java, Scala or any of the other JVM languages. The key here is that you set up your project normally, as if nothing else needed to be done. You don't need to add any extra information or configuration to the core.

2. Create the Overlay

Create a .jdk-overlay with all the files you want installed on top of the existing JDK.

The premise of this is pretty simple: set up all the new files and files to be overwritten in the same structure you installed them locally and we will copy and/or overwrite the files before the build starts. This follows a convention similar to the Heroku JDK Customization paradigm. I liked how this was done and decided it was how I wanted to approach things in all of my projects. If you look at this project's file structure, you will see exactly how things are laid out for the JRE on my system. Don't get too picky about it as this is just a quick/dirty example of how to get it rolling. More care should be taken for an actual production deployment in how things are set up and which files are dropped where.

You can grab the files your need (for Java 8) from here:

We can now tell CircleCI how to make use of our overlay.

3. Rsync the Overlay

We know that CircleCI will have a $JAVA_HOME environment variable ready for us. We also know that CircleCI will provide us a base option that is an Ubuntu Linux system. This means we know where Java is installed and that we can use the Linux standard rsync command to do what we need. So here's what we need:

  1. Create a circle.yml file in your project root
  2. Specify your Java version with one of the predefined constants
  3. Create a dependencies element with a pre sub-element
  4. Add the rsync command to execute the overlay.

You should have the following somewhere in your YML:

machine:
  java:
    version: oraclejdk8

dependencies:
  pre:
    - sudo rsync -r --include=*/ --include=*.jar --exclude=* .jdk-overlay/jre $JAVA_HOME

It doesn't matter what files you add to your overlay as long as they are in the proper structure. Here's a breakdown of that command:

  • Use sudo so we have permission to write over the JDK files
  • Use -r so that the command is executed recursively
  • Use the first --include to ensure that we copy files and directories from the root of the .jdk-overlay directory
  • Use the second --include to instruct rsync to only deal with Jar files (obviously you should change this if you have other file types included)
  • Use --exclude to ensure that everything else gets excluded (another reason we need the first --include, but I had problems exluding one or the other)
  • Specify the source directory to copy
  • Specify the target for the overlay (yes, leave off the /jre from the end)

4. Add Your Files & Push

All that's left now is to get the build running. Add your files to Git and then execute a push. From there your CircleCI integration with your GitHub account should take over and all should be happy. You're notice in our classes and test classes in this project that we specifically look for the Bouncy Castle license and an appropriate key length from within Java core. That's it!

java-circleci's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.