4

I'm trying to test making changes to the Spoon source (trying to learn how it all works) but can't figure out how to build the final jar (with dependencies similar to the one available from the site) that we can then use to run independently.

I tried running the ./gradlew build and ./gradlew install with some minor code changes and everything builds successfully but I can't locate the JAR that works properly. :(

Any help / documentation related to the build/release process would be much appreciated.

Bootstrapper
  • 1,089
  • 3
  • 14
  • 33
  • Just to add I build the JAR with ./gradlew build but when trying with that get an error `no main manifest attribute, in spoon-runner/build/libs/spoon-runner-2.0.0-SNAPSHOT.jar` – Bootstrapper Mar 26 '17 at 18:14
  • How are you trying to use it? (please update the question, not just comment). I see the jar in ./spoon-runner/build/lib/spoon-runner-2.0.0-SNAPSHOT-all.jar (it has over 11MB and all dependencies included inside, shadow jar style) – MartinTeeVarga Mar 29 '17 at 01:49

1 Answers1

1
  1. Import project in Intellij Idea (not Android studio)
    • Import project from external model Gradle
    • Next -> Finish
  2. Then you'll receive

Error:SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.

Create local.properties file in root directory with following content:

sdk.dir=/Users/yourusername/Library/Android/sdk

If you see problems with gradle, press on gradle menu (tab at the right side) and click on synchronize/refresh button.

  1. Open Project Structure -> Modules. Click + -> Import module -> spoon-client -> Import module from external model Gradle -> Next -> Next. Do the same procedure for spoon-runner and click Apply.

  2. Open Project Structure -> Artifacts. Click + -> JAR -> From modules with dependencies... Select spoon-client, leave Main class empty, press OK. Do the same procedure for spoon-runner. Click Apply -> OK.

  3. Click Build -> Build Artifacts... -> All artifacts.

JARs will be created at the location you have specified in the Artifacts menu.

enter image description here

enter image description here

azizbekian
  • 60,783
  • 13
  • 169
  • 249