Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Java Web Start czyli jak żyć z tą dziwną technologią & Continuous Delivery w projekcie Open Source - Marcin Stachniuk WroclawJUG

228 views

Published on

Java Web Start czyli jak żyć z tą dziwną technologią & Continuous Delivery w projekcie Open Source - Marcin Stachniuk WroclawJUG

Published in: Software
  • Be the first to comment

  • Be the first to like this

Java Web Start czyli jak żyć z tą dziwną technologią & Continuous Delivery w projekcie Open Source - Marcin Stachniuk WroclawJUG

  1. 1. Java Web Start czyli jak żyć z tą dziwną technologią? & Continuous Delivery w projekcie Open Source Marcin Stachniuk @MarcinStachniuk mstachniuk.blogspot.com WrocJUG 04.04.2017
  2. 2. Agenda ● Introduction ● Build Pipeline ● Continuous Integration ● Continuous Delivery ● Code Quality ● Nice Badges ● Promotion in the Internet ● Alternatives ● Q&A ● Bonuses ● What is Java Web Start? ● How it works? ● What can goes wrong? ● Solution ● How IceBoar works? ● Benefits ● Q&A
  3. 3. Agenda ● Introduction ● Build Pipeline ● Continuous Integration ● Continuous Delivery ● Code Quality ● Nice Badges ● Promotion in the Internet ● Alternatives ● Q&A ● Bonuses ● What is Java Web Start? ● How it works? ● What can goes wrong? ● Solution ● How IceBoar works? ● Benefits ● Q&A +
  4. 4. Java Web Start – jak żyć z tą dziwną technologią? Marcin Stachniuk
  5. 5. Java Platform Standard Edition 8 Documentation https://docs.oracle.com/javase/8/docs/
  6. 6. Java Platform Tutorial: Swing https://docs.oracle.com/javase/tutorial/uiswing/components/text.html
  7. 7. Example JNLP file <?xml version="1.0" encoding="utf-8"?> <!-- JNLP File for TextSamplerDemo --> <jnlp spec="1.0+" codebase="https://docs.oracle.com/javase/tutorialJWS/samples/uiswing/TextSamplerDemoProject" href="TextSamplerDemo.jnlp"> <information> <title>TextSamplerDemo</title> <vendor>The Java(tm) Tutorial</vendor> <homepage href="https://docs.oracle.com/javase/tutorial/uiswing/examples/components/index.html#TextSamplerDemo"/> <description>TextSamplerDemo</description> <description kind="short">Uses one of each of Swing's text components.</description> <offline-allowed/> </information> <resources> <j2se version="1.7+"/> <jar href="TextSamplerDemo.jar"/> </resources> <application-desc main-class="components.TextSamplerDemo"/> </jnlp>
  8. 8. Java Web Start Sequence Diagram
  9. 9. Java Web Start Sequence Diagram click
  10. 10. Java Web Start Sequence Diagram click download
  11. 11. Java Web Start Sequence Diagram click download run
  12. 12. Java Web Start Sequence Diagram click download run are you sure?
  13. 13. Java Web Start Sequence Diagram click download run are you sure? download JARs
  14. 14. Java Web Start Sequence Diagram run application on javaws click download run are you sure? download JARs
  15. 15. Java Web Start Sequence Diagram run application on javaws click download run are you sure? download JARs
  16. 16. What could possibly go wrong? In JNLP: <j2se version="1.7"/> User: Java 1.8
  17. 17. What could possibly go wrong? ● Different Java versions installed on client machines ● Sometimes javaws wants download and install newest JRE version ● Different behavior depends on Operating System and installed JRE version ● From some point of time apps needs to signed (Self-signed are blocked) ● Application started in sandbox (javaws or jp2launcher)
  18. 18. Problem solution
  19. 19. Problem solution
  20. 20. Problem solution https://github.com/Roche/IceBoar
  21. 21. How IceBoar works?
  22. 22. How IceBoar works? click
  23. 23. How IceBoar works? click download
  24. 24. How IceBoar works? click download run
  25. 25. How IceBoar works? click download run are you sure?
  26. 26. How IceBoar works? click download run are you sure? download & run
  27. 27. How IceBoar works? click download run are you sure? download & run download JRE
  28. 28. How IceBoar works? click download run are you sure? download & run download JRE download JARs
  29. 29. How IceBoar works? click download run are you sure? download & run download JRE download JARs run on our JRE
  30. 30. How IceBoar works? click download run are you sure? download & run download JRE download JARs run on our JRE
  31. 31. How IceBoar works? click download run are you sure? download & run download JRE download JARs run on our JRE
  32. 32. Demo
  33. 33. Profits ● We know a target JVM version ● Application start outside a sandbox (java instead of javaws) ● We sign only IceBoar jar ● Users don’t needs admin rights to install JRE
  34. 34. How to introduce IceBoar into a project? <dependency> <groupId>com.roche</groupId> <artifactId>ice-boar</artifactId> <version>${project.version}</version> <classifier>jar-with-dependencies</classifier> </dependency>
  35. 35. How to introduce IceBoar into a project? <jnlp spec="1.0+" codebase="${codebase}"> <information> .... </information> <security> <all-permissions/> </security> <resources> <j2se version="1.5+" href="http://java.sun.com/products/autodl/j2se"/> <jar href="${jre.and.jars.host}/${jars.path}/ice-boar-1.0-jar-with-dependencies.jar"/> <property name="jnlp.IceBoar.close-on-end" value="false"/> <property name="jnlp.IceBoar.main-class" value="com.roche.iceboar.helloworldswing.HelloWorld"/> <property name="jnlp.IceBoar.jar.0" value="${jre.and.jars.host}/${jars.path}/ice-boar-hello-world-swing-${version}-jar-with-dependencies.jar"/> <property name="jnlp.IceBoar.splash" value="${jre.and.jars.host}/img/ice-boar-splash.png"/> </resources> <application-desc main-class="com.roche.iceboar.IceBoar"> </application-desc> </jnlp>
  36. 36. Site with examples http://roche.github.io/IceBoar/
  37. 37. Other features of IceBoar? ● Custom splash screen during loading ● No frame around splash screen ● Custom title and icon ● Starting application using pre-installed JRE ● Cache for downloaded JRE (for slow connections) ● Window with logs output ● Disable auto close IceBoar window after starting target application
  38. 38. Questions ?
  39. 39. Continuous Delivery w projekcie Open Source
  40. 40. Continuous Delivery Vs. Continuous Deployment
  41. 41. Continuous Delivery Vs. Continuous Deployment https://puppet.com/blog/continuous-delivery-vs-continuous-deployment-what-s-diff
  42. 42. Inspiration JDD2014: Continuous Delivery: Capitalizing High Quality Automated Tests (Sz. Faber) https://www.youtube.com/watch?v=Lda4RuQDQN0
  43. 43. Build Pipeline
  44. 44. Continuous Delivery </>
  45. 45. Continuous Delivery </> code github.io github.com travis-ci.org codecov.io bintray.com oss.jfrog.org search.maven.org
  46. 46. Continuous Delivery </>
  47. 47. Continuous Delivery </> 1 git push
  48. 48. Continuous Delivery </> 1 git push 2 webhook build
  49. 49. Continuous Delivery </> 1 git push 2 webhook build 3 deploy release snapshot
  50. 50. Continuous Delivery </> 1 git push 2 webhook build 3 deploy release snapshot 4 commit to gh-pages
  51. 51. Continuous Delivery </> 1 git push 2 webhook build 3 deploy release snapshot 4 commit to gh-pages 5 update gh-pages
  52. 52. Continuous Delivery </> 1 git push 2 webhook build 3 deploy release snapshot 6 code coverage 4 commit to gh-pages 5 update gh-pages
  53. 53. Continuous Delivery </> 1 git push 2 webhook build 3 deploy release snapshot 6 code coverage 7 sing & publish (manual) 4 commit to gh-pages 5 update gh-pages
  54. 54. Continuous Delivery Deployment </> 1 git push 2 webhook build 3 deploy release snapshot 6 code coverage 7 sing & publish (manual) 4 commit to gh-pages 5 update gh-pages 7 sing & publish auto not implemented dream
  55. 55. Continuous Integration
  56. 56. Continuous Integration https://travis-ci.org ● Free for Open Source Projects ● Easy setup with GitHub ● Container base architecture (Doker) ● Stateless
  57. 57. Continuous Integration https://travis-ci.org ● Free for Open Source Projects ● Easy setup with GitHub ● Container base architecture (Doker) ● Stateless ● Multi language support (ANDROID, C, C#, C++, CLOJURE, CRYSTAL, D, DART, ERLANG, ELIXIR, F#, GO, GROOVY, HASKELL, HAXE, JAVA, JAVASCRIPT (WITH NODE.JS), JULIA, OBJECTIVE-C, PERL, PERL6, PHP, PYTHON, R, RUBY, RUST, SCALA, SMALLTALK, VISUAL BASIC) ● For Java: Oracle JDK 7 (default), Oracle JDK 8, OpenJDK 6, OpenJDK 7, Gradle 2.0, Maven 3.2 and Ant 1.8 ● Notifications via: Slack, HipChat, Emails and more
  58. 58. How to setup Travis-CI .travis.yml language: java script: mvn clean install jdk: - oraclejdk8 ● Sign travis-ci.org using GitHub account ● Choose project (you need to have admin rights to this project) ● Add .travis.yml to your root project folder
  59. 59. Default Travis-CI java build .travis.yml language: java jdk: - oraclejdk8 .travis.yml language: java install: mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V script: mvn test -B jdk: - oraclejdk8 Default Travis-CI maven build seps: ● install ● script
  60. 60. Default Travis-CI java build .travis.yml language: java jdk: - oraclejdk8 .travis.yml language: java install: mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V script: mvn test -B jdk: - oraclejdk8 Default Travis-CI maven build seps: ● install ● script
  61. 61. Default Travis-CI java build .travis.yml language: java jdk: - oraclejdk8 .travis.yml language: java install: mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V script: mvn test -B jdk: - oraclejdk8 Default Travis-CI maven build seps: ● install ● script
  62. 62. Store sensitive data (passwords) on travis-ci <settings ...> <servers> <server> <id>bintray-stachnim-IceBoar</id> <username>${env.CI_DEPLOY_USERNAME}</username> <password>${env.CI_DEPLOY_PASSWORD}</password> </server> settings.xml
  63. 63. Store sensitive data (passwords) on travis-ci
  64. 64. Store sensitive data (passwords) on travis-ci
  65. 65. Current IceBoar Build in nutshell #!/bin/bash set -ev if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then cd ice-boar && mvn clean deploy --settings … else cd ice-boar && mvn clean install && ... fi build-travis.sh language: java script: ./build-travis.sh jdk: - oraclejdk8 .travis.yml
  66. 66. Continuous Delivery
  67. 67. Release artifact to Maven Central is not so easy ● Complicated Requirements ● Hard to sign in / create account (need to find link and create an issue) ● Manual verification of uploaded artifact
  68. 68. Release artifact to bintray ● Sign in with GitHub ● Add new package to maven repository, configure it ● Deploy to bintray (from Travis-CI) ● You don’t need to sign your artifact
  69. 69. Bintray general repository settings
  70. 70. Bintray deploy to Maven Central ● You can’t store user token password :-( ● This will be manual step :-(
  71. 71. Google Developers: The Secret to Safe Continuous Deployment www.youtube.com/watch?v=UMnZiTL0tUc github.com/bslatkin/dpxdt
  72. 72. Continuous Delivery to GitHub Pages 4 commit to gh-pages 5 update gh-pages Build on Travis-CI build GitHub Pages project and commit to gh-pages branch
  73. 73. Code Quality
  74. 74. Code Quality with codecov.io ● Sign in codecov.io with GitHub ● Configure jacoco-maven-plugin ● Add to .travis.yml: language: java script: ./build-travis.sh jdk: - oraclejdk8 before_install: - pip install --user codecov after_success: - codecov .travis.yml
  75. 75. Codecov see Code Coverage
  76. 76. Codecov Extension (for Chrome) - see coverage on GitHub https://chrome.google.com/webstore/detail/codecov-extension/
  77. 77. Codecov suggestions
  78. 78. IceBoar build in details
  79. 79. IceBoar project structure in detail Roche/IceBoar pom.xml (project name: ice-boar-build) ice-boar (without reference to parent pom) ice-boar-samples ice-boar-demo-gh-pages ice-boar-demo ice-boar-hello-world-swing
  80. 80. Current IceBoar Build in details language: java script: ./build-travis.sh jdk: - oraclejdk8 before_install: - pip install --user codecov after_success: - codecov cache: directories: - $HOME/.m2 // cache dir between builds install: true // skip install script .travis.yml
  81. 81. Current IceBoar Build in details #!/bin/bash set -ev if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then ... else cd ice-boar mvn clean install cd .. mvn clean install -U fi build-travis.sh set -ev -e fail fast -v print all lines in the script before executing them
  82. 82. Current IceBoar Build in details cd ice-boar mvn clean deploy --settings settings.xml cd .. mvn clean install -U cd ice-boar-samples/ice-boar-demo-gh-pages/ mvn clean install -P ghpages git clone https://github.com/Roche/IceBoar cd IceBoar git checkout gh-pages && cp -R ../target/ice-boar-demo-gh-pages/* . build-travis.sh Roche/IceBoar ice-boar ice-boar-samples ice-boar-demo-gh-pages ice-boar-demo ice-boar-hello-world-swing
  83. 83. Current IceBoar Build in details cd ice-boar mvn clean deploy --settings settings.xml cd .. mvn clean install -U cd ice-boar-samples/ice-boar-demo-gh-pages/ mvn clean install -P ghpages git clone https://github.com/Roche/IceBoar cd IceBoar git checkout gh-pages && cp -R ../target/ice-boar-demo-gh-pages/* . build-travis.sh Roche/IceBoar ice-boar ice-boar-samples ice-boar-demo-gh-pages ice-boar-demo ice-boar-hello-world-swing
  84. 84. Current IceBoar Build in details cd ice-boar mvn clean deploy --settings settings.xml cd .. mvn clean install -U cd ice-boar-samples/ice-boar-demo-gh-pages/ mvn clean install -P ghpages git clone https://github.com/Roche/IceBoar cd IceBoar git checkout gh-pages && cp -R ../target/ice-boar-demo-gh-pages/* . build-travis.sh Roche/IceBoar ice-boar ice-boar-samples ice-boar-demo-gh-pages ice-boar-demo ice-boar-hello-world-swing
  85. 85. Current IceBoar Build in details cd ice-boar mvn clean deploy --settings settings.xml cd .. mvn clean install -U cd ice-boar-samples/ice-boar-demo-gh-pages/ mvn clean install -P ghpages git clone https://github.com/Roche/IceBoar cd IceBoar git checkout gh-pages && cp -R ../target/ice-boar-demo-gh-pages/* . build-travis.sh Roche/IceBoar ice-boar ice-boar-samples ice-boar-demo-gh-pages ice-boar-demo ice-boar-hello-world-swing IceBoar
  86. 86. Current IceBoar Build in details cd ice-boar mvn clean deploy --settings settings.xml cd .. mvn clean install -U cd ice-boar-samples/ice-boar-demo-gh-pages/ mvn clean install -P ghpages git clone https://github.com/Roche/IceBoar cd IceBoar git checkout gh-pages && cp -R ../target/ice-boar-demo-gh-pages/* . build-travis.sh Roche/IceBoar ice-boar ice-boar-samples ice-boar-demo-gh-pages ice-boar-demo ice-boar-hello-world-swing IceBoar
  87. 87. Current IceBoar Build in details git config user.name "Marcin Stachniuk" git config user.email mstachniuk@...com git add -A git commit -m "update gh-pages by Travis-CI" git push ${GIT_HUB_REPO_SECRET} build-travis.sh Roche/IceBoar ice-boar ice-boar-samples ice-boar-demo-gh-pages ice-boar-demo ice-boar-hello-world-swing IceBoar
  88. 88. Nice badges
  89. 89. Nice badges shields.io
  90. 90. Promotion in the Internet
  91. 91. What is important for users? ● Nice demo page with example usage: roche.github.io/IceBoar/
  92. 92. What is important for users? ● Easy setup for contributors
  93. 93. What is important for promotion? ● Stack Overflow: stackoverflow.com/search?q=ice+boar
  94. 94. How to promote in the Internet? ● Blogposts ● Another forums, groups, etc. ● Hackergarten (1 Pull Request,1 commit, 2 contributors) ● Presentations on JUG’s and conferences ● Coding in train (1 Pull Request, 16 commits, 1 contributor)
  95. 95. Alternatives
  96. 96. Alternatives to Travic-CI ● gitlab.com ● BitBucket host in the cloud ● teamcity.codebetter.com/login.html ● teamcity.jetbrains.com ● www.appveyor.com (for .NET) ● scrutinizer-ci.com (+ code metrics) ● codeship.com (run Docker’s, support for: Ruby (Rails), Node.js, PHP, Python, Java, Go) ● magnum-ci.com (+ code metrics) ● circleci.com ● www.visualstudio.com/en-us/products/visual-studio-team-services-vs.aspx ● app.shippable.com (support for Ruby, Python, Java, Node.js, Scala, PHP, Clojure, Go) ● www.snap-ci.com (by ThoughtWorks)
  97. 97. Alternatives for codecov.io ● coveralls.io ● nemo.sonarqube.org (BETA - need to write an e-mail on e-mail list for account) ● sonar.qatools.ru ● coverity.com (for: C, C++, C#, Java) ● www.codacy.com (for Scala, Ruby, Java, JavaScript, Python, Php)
  98. 98. Others ● javadoc.io
  99. 99. LuxLekarz - LuxMed + ZnanyLekarz github.com/mstachniuk/LuxLekarz
  100. 100. Mockito Release Tools github.com/mockito/mockito-release-tools
  101. 101. Questions ?
  102. 102. Links ● https://puppet.com/blog/continuous-delivery-vs-continuous-deployment-what-s-diff Continuous Delivery Vs. Continuous Deployment: What's the Diff? ● https://www.youtube.com/watch?v=Lda4RuQDQN0 Szczepan Faber about Continuous Delivery ● https://docs.oracle.com/javase/8/docs/ Java Platform Standard Edition 8 Documentation ● https://github.com/Roche/IceBoar IceBoar on GitHub ● https://github.com GitHub Source Code repository ● https://github.io GitHub Pages ● https://travis-ci.org Travis-CI Continuous Integration Server ● https://codecov.io Collect your code coverage ● https://bintray.com Popular repository for your artifacts (not only Jar files) ● https://oss.jfrog.org Repository for OSS snapshots ● https://search.maven.org The Maven Central ● https://docs.travis-ci.com/user/pull-requests#Security-Restrictions-when-testing-Pull-Requests Why sometimes PR from fork fail on Travis-Ci ● http://central.sonatype.org/pages/requirements.html Requirements for release in to Maven Central ● https://issues.sonatype.org Create issue for new account on Maven Central ● https://www.youtube.com/watch?v=UMnZiTL0tUc Google Developers The Secret to Safe Continuous Deployment ● https://chrome.google.com/webstore/detail/codecov-extension Codecov extension (for Google Chrome) ● http://shields.io Nice badges generator ● https://roche.github.io/IceBoar Demo page for IceBoar ● http://stackoverflow.com/search?q=ice+boar IceBoar on Stack Overflow
  103. 103. Java Web Start czyli jak żyć z tą dziwną technologią? & Continuous Delivery w projekcie Open Source Marcin Stachniuk @MarcinStachniuk mstachniuk.blogspot.com WrocJUG 04.04.2017 Dziękuję!

×