Skip to content

Commit 22f71ca

Browse files
authored
Merge pull request #23 from devsapp/refine-java-example
refine java example use std mvn
2 parents 3eb0b72 + 34aedee commit 22f71ca

File tree

6 files changed

+49
-19
lines changed

6 files changed

+49
-19
lines changed

event-function/fc-event-java8/publish.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Type: Application
22
Name: start-fc-event-java8
3-
Version: 1.1.10
3+
Version: 1.1.11
44
Provider:
55
- 阿里云
66
Description: 快速部署一个 Java 8 的 Event 类型的 Hello World 函数到阿里云函数计算。

event-function/fc-event-java8/src/pom.xml

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
1+
<project xmlns="http://maven.apache.org/POM/4.0.0"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>example</groupId>
5-
<artifactId>ServerlessToolProject</artifactId>
5+
<artifactId>HelloFCJava</artifactId>
66
<packaging>jar</packaging>
77
<version>1.0-SNAPSHOT</version>
8-
<name>ServerlessToolProject</name>
8+
<name>HelloFCJava</name>
99

1010
<dependencies>
1111
<dependency>
@@ -21,6 +21,28 @@
2121
</dependency>
2222
</dependencies>
2323

24+
<build>
25+
<plugins>
26+
<plugin>
27+
<artifactId>maven-assembly-plugin</artifactId>
28+
<configuration>
29+
<descriptorRefs>
30+
<descriptorRef>jar-with-dependencies</descriptorRef>
31+
</descriptorRefs>
32+
</configuration>
33+
<executions>
34+
<execution>
35+
<id>make-my-jar-with-dependencies</id>
36+
<phase>package</phase>
37+
<goals>
38+
<goal>single</goal>
39+
</goals>
40+
</execution>
41+
</executions>
42+
</plugin>
43+
</plugins>
44+
</build>
45+
2446
<properties>
2547
<maven.compiler.target>1.8</maven.compiler.target>
2648
<maven.compiler.source>1.8</maven.compiler.source>

event-function/fc-event-java8/src/s.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ services:
2525
component: fc
2626
actions: # 自定义执行逻辑
2727
pre-deploy: # 在deploy之前运行
28-
- run: s build # 要运行的命令行
28+
- run: mvn package # 要运行的命令行
2929
path: ./ # 命令行运行的路径
3030
# post-deploy: # 在deploy之后运行
3131
# - run: s versions # 要运行的命令行
@@ -37,7 +37,7 @@ services:
3737
name: event-java8
3838
description: 'hello world by serverless devs'
3939
runtime: java8
40-
codeUri: ./
40+
codeUri: ./target
4141
# ossBucket:
4242
# ossKey: # conflict with codeUri
4343
handler: example.App::handleRequest

http-function/fc-http-java8/publish.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Type: Application
22
Name: start-fc-http-java8
3-
Version: 1.1.10
3+
Version: 1.1.11
44
Provider:
55
- 阿里云
66
Description: 快速部署一个 Java 8 的 HTTP 类型的 Hello World 函数到阿里云函数计算。

http-function/fc-http-java8/src/pom.xml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
1+
<project xmlns="http://maven.apache.org/POM/4.0.0"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>example</groupId>
5-
<artifactId>ServerlessToolProject</artifactId>
5+
<artifactId>HelloFCJava</artifactId>
66
<packaging>jar</packaging>
77
<version>1.0-SNAPSHOT</version>
8-
<name>ServerlessToolProject</name>
8+
<name>HelloFCJava</name>
99

1010
<dependencies>
1111
<dependency>
@@ -24,13 +24,21 @@
2424
<build>
2525
<plugins>
2626
<plugin>
27-
<groupId>org.apache.maven.plugins</groupId>
28-
<artifactId>maven-compiler-plugin</artifactId>
29-
<version>3.6.1</version>
27+
<artifactId>maven-assembly-plugin</artifactId>
3028
<configuration>
31-
<source>1.8</source>
32-
<target>1.8</target>
29+
<descriptorRefs>
30+
<descriptorRef>jar-with-dependencies</descriptorRef>
31+
</descriptorRefs>
3332
</configuration>
33+
<executions>
34+
<execution>
35+
<id>make-my-jar-with-dependencies</id>
36+
<phase>package</phase>
37+
<goals>
38+
<goal>single</goal>
39+
</goals>
40+
</execution>
41+
</executions>
3442
</plugin>
3543
</plugins>
3644
</build>

http-function/fc-http-java8/src/s.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ services:
2525
component: fc
2626
actions: # 自定义执行逻辑
2727
pre-deploy: # 在deploy之前运行
28-
- run: s build # 要运行的命令行
28+
- run: mvn package # 要运行的命令行
2929
path: ./ # 命令行运行的路径
3030
# post-deploy: # 在deploy之后运行
3131
# - run: s versions # 要运行的命令行
@@ -37,7 +37,7 @@ services:
3737
name: http-trigger-java8
3838
description: 'hello world by serverless devs'
3939
runtime: java8
40-
codeUri: ./
40+
codeUri: ./target
4141
# ossBucket:
4242
# ossKey: # conflict with codeUri
4343
handler: example.App::handleRequest

0 commit comments

Comments
 (0)