Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use now maven-exec to create packages as part of the build #871

Conversation

cedricwalter
Copy link
Contributor

@cedricwalter cedricwalter commented Jul 16, 2017

packaging make easy part of the build. During maven package phase installer are created.

Tested on Windows and Linux Ubuntu.

Features:

  • automatic signing of installer with GPG
  • no external script to maintain: all is in pom.xml

Requirements

create a master password

mvn --encrypt-master-password <password>
This command will produce an encrypted version of the password, something like
{jSMOWnoPFgsHVpMvz5VrIt5kRbzGpI8u+9EF1iFQyJQ=}
Store this password in the ${user.home}/.m2/settings-security.xml; it should look like

<settingsSecurity>
  <master>{jSMOWnoPFgsHVpMvz5VrIt5kRbzGpI8u+9EF1iFQyJQ=}</master>
</settingsSecurity>

secure your gpg2 passphrase

mvn --encrypt-password <mypassphrase password>
And store the result in a profile in ${user.home}/.m2/settings.xml

<profiles>
   <profile>
      <id>sign-bisq-artifacts</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <properties>
        <gpg.executable>gpg2</gpg.executable>
        <gpg.passphrase>xxxxxxxx encypted xxxxxxxxxxxx</gpg.passphrase>
      </properties>
    </profile>  
  </profiles>

this could be done for development, or if you dont like this at all or dont trust it, you can always run
mvn package/deploy -Dgpg.passphrase=thephrase
If you don't specify a passphrase, it will prompt for one.

32 bits vs 64 bits

Javapackager bundling with 32/64-bit is triggered off the JDK used.

So to build the 5 installers, run maven package/deploy -Dgpg.passphrase=thephrase in each virtual machine, with the corresponding JDK

  • windows 32 bits use openJDK 32 bits,
  • windows 64 bits use openJDK 64 bits
  • linux 32 bits use openJDK 32 bits
  • linux 64 bits use openJDK 64 bits
  • OsX 64 bits use openJDK 64 bits

@cedricwalter
Copy link
Contributor Author

Possible errors

in gui/pom.xml we use ${env.JAVA_HOME}/jre, is your java home properly set?

[INFO] --- exec-maven-plugin:1.6.0:exec (package-osx-installer) @ gui ---
Exception in thread "main" com.sun.javafx.tools.packager.PackagerException: Error: deploy failed
at com.sun.javafx.tools.packager.PackagerLib.generateDeploymentPackages(PackagerLib.java:324)
at com.sun.javafx.tools.packager.Main.main(Main.java:476)
Caused by: java.lang.RuntimeException: The file for the Runtime/JRE directory does not exist.
at com.oracle.tools.packager.mac.MacAppBundler.createMacRuntimeRules(MacAppBundler.java:952)
at com.oracle.tools.packager.BundlerParamInfo.fetchFrom(BundlerParamInfo.java:132)
at com.oracle.tools.packager.mac.MacAppBundler.extractMacRuntime(MacAppBundler.java:282)
at com.oracle.tools.packager.BundlerParamInfo.fetchFrom(BundlerParamInfo.java:116)
at com.sun.javafx.tools.packager.bundlers.BundleParams.getRuntime(BundleParams.java:262)
at com.sun.javafx.tools.packager.PackagerLib.generateNativeBundles(PackagerLib.java:331)
at com.sun.javafx.tools.packager.PackagerLib.generateDeploymentPackages(PackagerLib.java:318)
... 1 more
Caused by: com.oracle.tools.packager.ConfigException: The file for the Runtime/JRE directory does not exist.

ManfredKarrer added a commit that referenced this pull request Oct 12, 2017
@ManfredKarrer
Copy link
Contributor

Hi @cedricwalter

I have merged that PR with Development to cedricwalter-Bitsquare_Icon_Missing_on_compiled_release and have a few questions:

You commented out the icon definition in the .iss file:
; SetupIconFile=Bisq.ico
; UninstallDisplayIcon=Bisq.ico

Another developer has set the path to that (not tested yet):
SetupIconFile=Bisq.ico
UninstallDisplayIcon={app}\Bisq.ico

Have you tested if the icon works on windows when removed?

The travis file got edited by @cbeams.
Could you and @cbeams cross check if my merge is correct?

When I run mvn package I get that error:

[INFO] Replacing /Users/dev/Documents/intellij/exchange_bisq/gui/target/gui-0.5.3-app.jar with /Users/dev/Documents/intellij/exchange_bisq/gui/target/gui-0.5.3-bundled.jar
[INFO] Attaching shaded artifact.
[INFO]
[INFO] --- exec-maven-plugin:1.6.0:exec (package-osx-installer) @ gui ---
Exception in thread "main" com.sun.javafx.tools.packager.PackagerException: Error: deploy failed
at com.sun.javafx.tools.packager.PackagerLib.generateDeploymentPackages(PackagerLib.java:324)
at com.sun.javafx.tools.packager.Main.main(Main.java:476)
Caused by: java.lang.RuntimeException: The file for the Runtime/JRE directory does not exist.
at com.oracle.tools.packager.mac.MacAppBundler.createMacRuntimeRules(MacAppBundler.java:952)
at com.oracle.tools.packager.BundlerParamInfo.fetchFrom(BundlerParamInfo.java:132)
at com.oracle.tools.packager.mac.MacAppBundler.extractMacRuntime(MacAppBundler.java:282)
at com.oracle.tools.packager.BundlerParamInfo.fetchFrom(BundlerParamInfo.java:116)
at com.sun.javafx.tools.packager.bundlers.BundleParams.getRuntime(BundleParams.java:262)
at com.sun.javafx.tools.packager.PackagerLib.generateNativeBundles(PackagerLib.java:331)
at com.sun.javafx.tools.packager.PackagerLib.generateDeploymentPackages(PackagerLib.java:318)
... 1 more
Caused by: com.oracle.tools.packager.ConfigException: The file for the Runtime/JRE directory does not exist.
... 8 more
[ERROR] Command execution failed.
org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:404)
at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166)
at org.codehaus.mojo.exec.ExecMojo.executeCommandLine(ExecMojo.java:804)
at org.codehaus.mojo.exec.ExecMojo.executeCommandLine(ExecMojo.java:751)
at org.codehaus.mojo.exec.ExecMojo.execute(ExecMojo.java:313)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] parent ............................................ SUCCESS [0.001s]
[INFO] common ............................................ SUCCESS [12.312s]
[INFO] jsocks ............................................ SUCCESS [0.142s]
[INFO] jtorctl ........................................... SUCCESS [0.164s]
[INFO] jtorproxy ......................................... SUCCESS [0.159s]
[INFO] network ........................................... SUCCESS [1.464s]
[INFO] core .............................................. SUCCESS [2.431s]
[INFO] gui ............................................... FAILURE [4.864s]
[INFO] seednode .......................................... SKIPPED
[INFO] statistics ........................................ SKIPPED
[INFO] provider .......................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 21.662s
[INFO] Finished at: Thu Oct 12 12:44:16 EST 2017
[INFO] Final Memory: 75M/1632M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.6.0:exec (package-osx-installer) on project gui: Command execution failed. Process exited with an error: 1 (Exit value: 1) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn -rf :gui

Any idea what causes that? Might be some of my merge changes caused a problem.

@cedricwalter
Copy link
Contributor Author

  1. yes was tested under windows
  2. you can remove the following in .travis.yml
 install:
    - git clone -b bisq_0.14.4.1 https://github.com/bitsquare/bitcoinj.git
 @@ -14,7 +27,8 @@ install:
    - mvn clean install -DskipTests
    - cd ..
  1. in gui/pom.xml we use ${env.JAVA_HOME}/jre, is your java home properly set?

@ManfredKarrer
Copy link
Contributor

@cedricwalter
Yes that I removed already:
https://github.com/bisq-network/exchange/blob/cedricwalter-Bitsquare_Icon_Missing_on_compiled_release/.travis.yml

Not sure about the other parts though....

@mrosseel
Copy link
Contributor

@cedricwalter getting the same error as Manfred on Mac:

[INFO] --- exec-maven-plugin:1.6.0:exec (package-osx-installer) @ gui ---
Exception in thread "main" com.sun.javafx.tools.packager.PackagerException: Error: deploy failed
	at com.sun.javafx.tools.packager.PackagerLib.generateDeploymentPackages(PackagerLib.java:324)
	at com.sun.javafx.tools.packager.Main.main(Main.java:476)
Caused by: java.lang.RuntimeException: The file for the Runtime/JRE directory does not exist.

Any hints/ideas on how to debug this?

@cedricwalter
Copy link
Contributor Author

Hi @mrosseel

yes look in gui/pom.xml line 455, this require a properly set ${env.JAVA_HOME}, so is your JAVA_HOME properly set in MacOS? see https://coderwall.com/p/8xy5eg/env-java_home-maven-intellij-idea-and-mavericks as it seems difficult to set properly on macos

@mrosseel
Copy link
Contributor

Running from command line, JAVA_HOME points to a jdk8 dir under which there is a /jre/bin/java - should be ok no?

@mrosseel
Copy link
Contributor

  • fixed part of it, the '\jre' should be changed to '/jre'. But then there's another issue, related to this bug: https://bugs.openjdk.java.net/browse/JDK-8154252
  • when removing the -Bruntime line, it works because then it uses the system JRE. If the runtime is specified, it doesn't find it because of the previous bug.

@mrosseel
Copy link
Contributor

hi Cedric,

It's working now on mac (might be interesting for you to buy a cheap second hand apple TV or a mac mini to test this stuff, always difficult to write if you don't have the OS).

this is my diff: https://gist.github.com/mrosseel/1e31f240911f59e45f95bee0492345c3
If you want a PR against your branch let me know, but the changes are fairly minimal.

@cedricwalter
Copy link
Contributor Author

Hi @mrosseel

Your diff is correct even if ${version} and ${project.version} are both valid, lets use the one that work everywhere on all platform .

You're also right i should get a MacOS device to test this in the future. My AMD1950x broke my VirtualBox Sierra VM. I will update now the PR with your changes.

@mrosseel
Copy link
Contributor

hi @cedricwalter

I changed the artifactId and version to project.artifactId and project.version because maven was complaining about it, this was not related to the mac osx bugs. Less warnings is always better, but I leave it to you to decide.

@cedricwalter
Copy link
Contributor Author

your changes are now inside this PR. I totally agree, was not seeing the maven warnings, build logs should stay clean.

…on_Missing_on_compiled_release

# Conflicts:
#	.travis.yml
#	gui/package/windows/Bisq.iss
#	gui/pom.xml
#	package/linux/32bitBuild.sh
#	package/linux/64bitBuild.sh
#	package/linux/Dockerfile
#	package/osx/create_app.sh
#	package/win/32bitBuild.bat
#	package/win/64bitBuild.bat
@cedricwalter
Copy link
Contributor Author

PR updated with development and conflicts resolved

@cbeams cbeams closed this Feb 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants