diff --git a/README.md b/README.md index 108cb50..da536ec 100644 --- a/README.md +++ b/README.md @@ -48,189 +48,17 @@ For more information consult the main repository [documentation](https://github. ## Getting Started -First we must create a new Java project. In this example we will use [Maven](https://maven.apache.org/) as our package manager. +First we must need to install spawn cli tool to create a new Java project. ```shell -mvn archetype:generate -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.4 +curl -sSL https://github.com/eigr/spawn/releases/download/v1.4.2/install.sh | sh ``` Now you will need to fill in the data for groupId, artifactId, version, and package. Let's call our maven artifact spawn-java-demo. The output of this command will be similar to the output below -```shell -$ mvn archetype:generate -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.4 -[INFO] Scanning for projects... -[INFO] Generating project in Interactive mode -[INFO] Archetype repository not defined. Using the one from [org.apache.maven.archetypes:maven-archetype-quickstart:1.4] found in catalog remote -Define value for property 'groupId': io.eigr.spawn -Define value for property 'artifactId': spawn-java-demo -Define value for property 'version' 1.0-SNAPSHOT: : -Define value for property 'package' io.eigr.spawn: : io.eigr.spawn.java.demo -Confirm properties configuration: -groupId: io.eigr.spawn -artifactId: spawn-java-demo -version: 1.0-SNAPSHOT -package: io.eigr.spawn.java.demo - Y: : y -[INFO] ---------------------------------------------------------------------------- -[INFO] Using following parameters for creating project from Archetype: maven-archetype-quickstart:1.4 -[INFO] ---------------------------------------------------------------------------- -[INFO] Parameter: groupId, Value: io.eigr.spawn -[INFO] Parameter: artifactId, Value: spawn-java-demo -[INFO] Parameter: version, Value: 1.0-SNAPSHOT -[INFO] Parameter: package, Value: io.eigr.spawn.java.demo -[INFO] Parameter: packageInPathFormat, Value: io/eigr/spawn/java/demo -[INFO] Parameter: package, Value: io.eigr.spawn.java.demo -[INFO] Parameter: groupId, Value: io.eigr.spawn -[INFO] Parameter: artifactId, Value: spawn-java-demo -[INFO] Parameter: version, Value: 1.0-SNAPSHOT -[INFO] Project created from Archetype in dir: /home/sleipnir/workspaces/eigr/spawn-java-demo -[INFO] ------------------------------------------------------------------------ -[INFO] BUILD SUCCESS -[INFO] ------------------------------------------------------------------------ -[INFO] Total time: 01:39 min -[INFO] Finished at: 2023-08-28T11:37:57-03:00 -[INFO] ------------------------------------------------------------------------ -``` -The second thing we have to do is add the spawn dependency to the project. - -```xml - - com.github.eigr - spawn-java-std-sdk - v1.3.1 - -``` -We're also going to configure a few things for our application build to work, including compiling the protobuf files. -See below a full example of the pom.xml file: - -```xml - - 4.0.0 - io.eigr.spawn - spawn-java-demo - jar - 1.0-SNAPSHOT - spawn-java-demo - https://eigr.io - - - 11 - 11 - UTF-8 - - - - - jitpack.io - https://jitpack.io - - - - - - com.github.eigr - spawn-java-std-sdk - v1.3.1 - - - ch.qos.logback - logback-classic - 1.4.7 - - - junit - junit - 4.13.2 - test - - - - - - - kr.motd.maven - os-maven-plugin - 1.6.2 - - - - - - org.apache.maven.plugins - maven-shade-plugin - - - - shade - - - true - - - io.eigr.spawn.java.demo.App - - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.7 - - - org.apache.maven.plugins - maven-compiler-plugin - - 11 - 11 - - - - org.xolstice.maven.plugins - protobuf-maven-plugin - 0.6.1 - - com.google.protobuf:protoc:3.19.2:exe:${os.detected.classifier} - grpc-java - io.grpc:protoc-gen-grpc-java:1.47.0:exe:${os.detected.classifier} - - - - - compile - compile-custom - - - - - - org.codehaus.mojo - build-helper-maven-plugin - 3.2.0 - - - add-test-sources - generate-test-sources - - add-test-source - - - - ${project.build.directory}/generated-test-sources/protobuf - - - - - - - - +```shell +spawn new java hello_world --group-id=io.eigr.spawn --artifact-id=spawn-java-demo --version=1.0.0 --package=io.eigr.spawn.java.demo ``` - Now it is necessary to download the dependencies via Maven: ```shell @@ -238,14 +66,7 @@ cd spawn-java-demo && mvn install ``` So far it's all pretty boring and not really Spawn related, so it's time to start playing for real. -The first thing we're going to do is define a place to put our protobuf files. In the root of the project we will create -a folder called protobuf and some sub folders - -```shell -mkdir -p src/main/proto/domain -``` - -That done, let's create our protobuf file inside the example folder. +The first thing we're going to do is define a place to put our protobuf files. ```shell touch src/main/proto/domain/domain.proto