Skip to content

Commit 3191fc5

Browse files
committed
Update readme to use spawn cli tool
1 parent 52de888 commit 3191fc5

File tree

1 file changed

+5
-184
lines changed

1 file changed

+5
-184
lines changed

README.md

+5-184
Original file line numberDiff line numberDiff line change
@@ -48,204 +48,25 @@ For more information consult the main repository [documentation](https://github.
4848

4949
## Getting Started
5050

51-
First we must create a new Java project. In this example we will use [Maven](https://maven.apache.org/) as our package manager.
51+
First we must need to install spawn cli tool to create a new Java project.
5252

5353
```shell
54-
mvn archetype:generate -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.4
54+
curl -sSL https://github.com/eigr/spawn/releases/download/v1.4.2/install.sh | sh
5555
```
5656
Now you will need to fill in the data for groupId, artifactId, version, and package.
5757
Let's call our maven artifact spawn-java-demo. The output of this command will be similar to the output below
58-
```shell
59-
$ mvn archetype:generate -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.4
60-
[INFO] Scanning for projects...
61-
[INFO] Generating project in Interactive mode
62-
[INFO] Archetype repository not defined. Using the one from [org.apache.maven.archetypes:maven-archetype-quickstart:1.4] found in catalog remote
63-
Define value for property 'groupId': io.eigr.spawn
64-
Define value for property 'artifactId': spawn-java-demo
65-
Define value for property 'version' 1.0-SNAPSHOT: :
66-
Define value for property 'package' io.eigr.spawn: : io.eigr.spawn.java.demo
67-
Confirm properties configuration:
68-
groupId: io.eigr.spawn
69-
artifactId: spawn-java-demo
70-
version: 1.0-SNAPSHOT
71-
package: io.eigr.spawn.java.demo
72-
Y: : y
73-
[INFO] ----------------------------------------------------------------------------
74-
[INFO] Using following parameters for creating project from Archetype: maven-archetype-quickstart:1.4
75-
[INFO] ----------------------------------------------------------------------------
76-
[INFO] Parameter: groupId, Value: io.eigr.spawn
77-
[INFO] Parameter: artifactId, Value: spawn-java-demo
78-
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
79-
[INFO] Parameter: package, Value: io.eigr.spawn.java.demo
80-
[INFO] Parameter: packageInPathFormat, Value: io/eigr/spawn/java/demo
81-
[INFO] Parameter: package, Value: io.eigr.spawn.java.demo
82-
[INFO] Parameter: groupId, Value: io.eigr.spawn
83-
[INFO] Parameter: artifactId, Value: spawn-java-demo
84-
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
85-
[INFO] Project created from Archetype in dir: /home/sleipnir/workspaces/eigr/spawn-java-demo
86-
[INFO] ------------------------------------------------------------------------
87-
[INFO] BUILD SUCCESS
88-
[INFO] ------------------------------------------------------------------------
89-
[INFO] Total time: 01:39 min
90-
[INFO] Finished at: 2023-08-28T11:37:57-03:00
91-
[INFO] ------------------------------------------------------------------------
92-
```
9358

94-
The second thing we have to do is add the spawn dependency to the project.
95-
96-
```xml
97-
<dependency>
98-
<groupId>com.github.eigr</groupId>
99-
<artifactId>spawn-java-std-sdk</artifactId>
100-
<version>v1.3.1</version>
101-
</dependency>
102-
```
103-
We're also going to configure a few things for our application build to work, including compiling the protobuf files.
104-
See below a full example of the pom.xml file:
105-
106-
```xml
107-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
108-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
109-
<modelVersion>4.0.0</modelVersion>
110-
<groupId>io.eigr.spawn</groupId>
111-
<artifactId>spawn-java-demo</artifactId>
112-
<packaging>jar</packaging>
113-
<version>1.0-SNAPSHOT</version>
114-
<name>spawn-java-demo</name>
115-
<url>https://eigr.io</url>
116-
117-
<properties>
118-
<maven.compiler.source>11</maven.compiler.source>
119-
<maven.compiler.target>11</maven.compiler.target>
120-
<project.encoding>UTF-8</project.encoding>
121-
</properties>
122-
123-
<repositories>
124-
<repository>
125-
<id>jitpack.io</id>
126-
<url>https://jitpack.io</url>
127-
</repository>
128-
</repositories>
129-
130-
<dependencies>
131-
<dependency>
132-
<groupId>com.github.eigr</groupId>
133-
<artifactId>spawn-java-std-sdk</artifactId>
134-
<version>v1.3.1</version>
135-
</dependency>
136-
<dependency>
137-
<groupId>ch.qos.logback</groupId>
138-
<artifactId>logback-classic</artifactId>
139-
<version>1.4.7</version>
140-
</dependency>
141-
<dependency>
142-
<groupId>junit</groupId>
143-
<artifactId>junit</artifactId>
144-
<version>4.13.2</version>
145-
<scope>test</scope>
146-
</dependency>
147-
</dependencies>
148-
149-
<build>
150-
<extensions>
151-
<extension>
152-
<groupId>kr.motd.maven</groupId>
153-
<artifactId>os-maven-plugin</artifactId>
154-
<version>1.6.2</version>
155-
</extension>
156-
</extensions>
157-
<!-- make jar runnable -->
158-
<plugins>
159-
<plugin>
160-
<groupId>org.apache.maven.plugins</groupId>
161-
<artifactId>maven-shade-plugin</artifactId>
162-
<executions>
163-
<execution>
164-
<goals>
165-
<goal>shade</goal>
166-
</goals>
167-
<configuration>
168-
<shadedArtifactAttached>true</shadedArtifactAttached>
169-
<transformers>
170-
<transformer implementation=
171-
"org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
172-
<mainClass>io.eigr.spawn.java.demo.App</mainClass>
173-
</transformer>
174-
</transformers>
175-
</configuration>
176-
</execution>
177-
</executions>
178-
</plugin>
179-
<plugin>
180-
<groupId>org.apache.maven.plugins</groupId>
181-
<artifactId>maven-surefire-plugin</artifactId>
182-
<version>2.7</version>
183-
</plugin>
184-
<plugin>
185-
<groupId>org.apache.maven.plugins</groupId>
186-
<artifactId>maven-compiler-plugin</artifactId>
187-
<configuration>
188-
<source>11</source>
189-
<target>11</target>
190-
</configuration>
191-
</plugin>
192-
<plugin>
193-
<groupId>org.xolstice.maven.plugins</groupId>
194-
<artifactId>protobuf-maven-plugin</artifactId>
195-
<version>0.6.1</version>
196-
<configuration>
197-
<protocArtifact>com.google.protobuf:protoc:3.19.2:exe:${os.detected.classifier}</protocArtifact>
198-
<pluginId>grpc-java</pluginId>
199-
<pluginArtifact>io.grpc:protoc-gen-grpc-java:1.47.0:exe:${os.detected.classifier}</pluginArtifact>
200-
</configuration>
201-
<executions>
202-
<execution>
203-
<goals>
204-
<goal>compile</goal>
205-
<goal>compile-custom</goal>
206-
</goals>
207-
</execution>
208-
</executions>
209-
</plugin>
210-
<plugin>
211-
<groupId>org.codehaus.mojo</groupId>
212-
<artifactId>build-helper-maven-plugin</artifactId>
213-
<version>3.2.0</version>
214-
<executions>
215-
<execution>
216-
<id>add-test-sources</id>
217-
<phase>generate-test-sources</phase>
218-
<goals>
219-
<goal>add-test-source</goal>
220-
</goals>
221-
<configuration>
222-
<sources>
223-
<source>${project.build.directory}/generated-test-sources/protobuf</source>
224-
</sources>
225-
</configuration>
226-
</execution>
227-
</executions>
228-
</plugin>
229-
</plugins>
230-
</build>
231-
</project>
59+
```shell
60+
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
23261
```
233-
23462
Now it is necessary to download the dependencies via Maven:
23563

23664
```shell
23765
cd spawn-java-demo && mvn install
23866
```
23967

24068
So far it's all pretty boring and not really Spawn related, so it's time to start playing for real.
241-
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
242-
a folder called protobuf and some sub folders
243-
244-
```shell
245-
mkdir -p src/main/proto/domain
246-
```
247-
248-
That done, let's create our protobuf file inside the example folder.
69+
The first thing we're going to do is define a place to put our protobuf files.
24970

25071
```shell
25172
touch src/main/proto/domain/domain.proto

0 commit comments

Comments
 (0)