javamacosintellij-ideaalloybnd

Running bnd-structured app in IDEA on MacOS: Unresolved requirement: Import-Package: com.apple.eawt


I'm trying to run Alloy (prkiens/markdown branch) from IntelliJ IDEA so I can use the IDEA debugger. This project uses a bnd workspace, which I've never dealt with before.

I'm running on macOS (High Sierra).

I loaded the project into IntelliJ by importing build.gradle and tried to set up a "Bnd OSGi" configuration to run it. I'm not sure which file to use as the Bnd run descriptor. My best guess was to use org.alloytools.alloy.dist/bnd.bnd. When I tried to run it I got the following error:

! could not resolve the bundles: [org.alloytools.alloy.dist-5.0.0.201803130320 org.osgi.framework.BundleException: Could not resolve module: org.alloytools.alloy.dist [1]
  Unresolved requirement: Import-Package: com.apple.eawt

What am I doing wrong here?

Note that building the project using Gradle works just fine:

./gradlew build
java -jar  org.alloytools.alloy.dist/target/org.alloytools.alloy.dist.jar

Solution

  • I think there is an IDEA bnd plugin It is not nearly as advanced as the Eclipse support but I think it recognizes the bnd files.

    Do not start with dist project since this just aggregates the different projects into a JAR for distribution and contains the code to create the MacOS pkg file. To run the GUI, simply debug the SimpleGUI class. bnd ensures that all necessary JARs are built continuously (on Eclipse at least).

    That said, save yourself some work and first get familiar in Eclipse with bndtools. In Eclipse it all works automatically. Once you understand how that works it should be easy to transfer that information to IDEA. (And write a wiki page for others!)

    Update Lorin added instructions on the readme