David --

  Thank you!  I will try doing this.

  -- Chris

----- Original Message -----
From: "David Gradwell" <da...@gradwell.com>
To: "COlsen" <col...@mchsi.com>
Cc: "users" <users@netbeans.apache.org>
Sent: Friday, September 4, 2020 8:21:33 AM
Subject: Re: Maven deployment plugin for JavaFX

Chris,



Hopefully some of the following will help.  We too did not want to use XCode 
(much!).  You have to install it and use certain upload/notarise tools, but 
that works.



So, my steps list is:



1.            Set up an Apple developer ID, pay fee etc.  using an email – we 
use a@b.c<mailto:a@b.c> in the following.



2.            Create and download a DeveloperID signing cert  to your 
development Mac's  login keychain from 
https://developer.apple.com/account/resources/certificates/list



3.            Create and download a Developer ID profile to System 
Preferences/Profiles.



4.            Build your project with Ant since Ant puts all the library files 
in a folder called lib in dist.  If Maven is your primary environment, just 
build the top level of the project with Ant.  If you know how to make Maven put 
all the dependencies in one place ready for jpackage please tell me !



5.            Local test the Ant project and if it behaves proceed.



6.            Make a Mac icon.



7.            Using the pre-release Java 15 (you will have to download it) then 
run jpackage with something like the following script.  I’ve hacked it a bit 
for confidentiality reasons.  There may be some space characters that need 
removing!.





export JAVA_HOME="/Users/myuser/Java Downloads/jdk-15.jdk/Contents/Home"



export PATH=" 
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Users/myuser/Java
 Downloads/jdk-15.jdk/Contents/Home/bin"



echo $PATH

rm -r /Users/myuser/NetBeansDev/MYAPPNAMEAnt/jpackageappimagetemp



rm -r /Users/myuser/NetBeansDev/MYAPPNAMEAnt/jpackageappimageoutput





jpackage --type app-image --app-version 0.0.1 --copyright "My company 2020" 
--name MYAPPNAME --dest 
/Users/myuser/NetBeansDev/MYAPPNAMEAnt/jpackageappimageoutput --temp 
/Users/myuser/NetBeansDev/MYAPPNAMEAnt/jpackageappimagetemp --vendor "My 
Company" --icon /Users/myuser/NetBeansDev/MYAPPNAMEAnt/MYAPPNAME.icns --input 
/Users/myuser/NetBeansDev/MYAPPNAMEAnt/dist --main-jar MYAPPNAMEAnt.jar 
--main-class com.you MYAPPNAME.SomeClass --java-options " 
-Xdock:name=MYAPPNAME" --mac-package-identifier MYAPPNAME --mac-sign 
--mac-signing-keychain "/Users/myuser/Library/Keychains/login.keychain-db" 
--verbose



8.            Check that the signing worked and that the app has appeared at 
/Users/myuser/NetBeansDev/MYAPPNAMEAnt/jpackageappimageoutput/MYAPPNAME.app and 
that it is double clickable and passes basic testing.  Make a backup of what 
you have created.



9.            Zip the .app using Finder compress.



10.          Upload


            See 
https://developer.apple.com/documentation/xcode/notarizing_macos_software_before_distribution/customizing_the_notarization_workflow
 section on “Upload Your App to the Notarization Service”.



                Create an application password using the Apple Developer site..





xcrun altool --notarize-app  --primary-bundle-id "MyAppNotarisation4Sept2020" 
--username a@b.c<mailto:a@b.c>  --password "Apple generated app password" 
--file 
/Users/myuser/NetBeansDev/MYAPPNAMEAnt/jpackageappimageoutput/MYAPPNAME.app.zip 
--verbose



Look at the output carefully and hope you get an email.



11.          Check the notarization history



xcrun altool --notarization-history 0 --username a@b.c<mailto:a@b.c>   
--password "Apple generated app password"



12.          Staple the .app



xcrun stapler staple 
"/Users/myuser/NetBeansDev/MYAPPNAMEAnt/jpackageappimageoutput/MYAPPNAME.app"



13.          Test:  You can now put the .app on your web site, down load it, 
copy it /Applications on any machine and then double click it.



We have also succeeded in making an installer and a .dmg.  The .dmg has to be 
made from the stapled .app.  This process is less tested.  Let me know if you 
get the above to work and I will share.



As mentioned, I’m working on a Java app to do all the above with one click – 
not finished yet !!



Regards



David





On 04/09/2020, 13:32, "Chris Olsen" <col...@mchsi.com> wrote:



    David --



      I am much interested in your statement...



      > We have also mastered the issues around Apple notarization needed to 
distribute an .app or .dmg.



      Can elaborate on this?  Or better yet provide some code or script to make 
this happen?   I do NOT want to mess with XCode!!



      -- Chris



    ----- Original Message -----

    From: "David Gradwell" <da...@gradwell.com>

    To: "HRH" <hrh...@yahoo.com.INVALID>, "users" <users@netbeans.apache.org>

    Sent: Friday, September 4, 2020 5:24:18 AM

    Subject: Re: Maven deployment plugin for JavaFX



    I have exactly the same question for any standard Java application.  In 
previous versions of NetBeans an Ant project used to provide this capability 
but Ant package as seems to be broken in NetBeans 12.  For example, using:



    Product Version: Apache NetBeans IDE 12.0



    Java: 14.0.1; OpenJDK 64-Bit Server VM 14.0.1+7



    Runtime: OpenJDK Runtime Environment 14.0.1+7

    We get  /AntProject/nbproject/build-native.xml:519: typedef class 
com.sun.javafx.tools.ant.FXJar cannot be found

    using the classloader AntClassLoader[].



    In order to use Maven which as you say appears not to support we now use 
jpackage successfully.  We have also mastered the issues around Apple 
notarization needed to distribute an .app or .dmg.



    So now we are working on a Java app that will do all the steps in one click 
for any application !



    I agree it would be nice to find a NetBeans plugin for Maven to do all the 
packaging.  If one needs writing then I am happy to contribute the logic and 
worked examples.



    David Gradwell

Reply via email to