Skip to content

Commit f90f09d

Browse files
feat: create new archetype (#1248)
1 parent 943fb41 commit f90f09d

21 files changed

Lines changed: 886 additions & 0 deletions

File tree

archetypes/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
</developers>
3333
<modules>
3434
<module>spring-boot3</module>
35+
<module>spring-boot4</module>
3536
</modules>
3637
<scm>
3738
<connection>scm:git:git://github.com/SAP/cloud-sdk-java.git</connection>

archetypes/spring-boot3/src/test/resources/projects/basic/goal.txt

Whitespace-only changes.

archetypes/spring-boot4/pom.xml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<parent>
5+
<groupId>com.sap.cloud.sdk.archetypes</groupId>
6+
<artifactId>archetypes-parent</artifactId>
7+
<version>5.34.0-SNAPSHOT</version>
8+
</parent>
9+
<artifactId>spring-boot4</artifactId>
10+
<packaging>maven-archetype</packaging>
11+
<name>Archetypes - SAP CP Cloud Foundry + Spring Boot 4</name>
12+
<description>Archetype for a Spring-based project on SAP Business Technology Platform (Cloud Foundry).</description>
13+
<url>https://sap.github.io/cloud-sdk/docs/java/getting-started</url>
14+
<organization>
15+
<name>SAP SE</name>
16+
<url>https://www.sap.com</url>
17+
</organization>
18+
<licenses>
19+
<license>
20+
<name>The Apache Software License, Version 2.0</name>
21+
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
22+
</license>
23+
</licenses>
24+
<developers>
25+
<developer>
26+
<name>SAP</name>
27+
<email>cloudsdk@sap.com</email>
28+
<organization>SAP SE</organization>
29+
<organizationUrl>https://www.sap.com</organizationUrl>
30+
</developer>
31+
</developers>
32+
<properties>
33+
<project.rootdir>${project.basedir}/../../</project.rootdir>
34+
</properties>
35+
</project>
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<archetype-descriptor
3+
xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0 http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd"
4+
name="Archetypes - SAP CP Cloud Foundry + Spring"
5+
xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0"
6+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
7+
8+
<requiredProperties>
9+
<requiredProperty key="artifactId">
10+
<validationRegex>[^_]+</validationRegex>
11+
</requiredProperty>
12+
<requiredProperty key="gitignore">
13+
<defaultValue>.gitignore</defaultValue>
14+
</requiredProperty>
15+
</requiredProperties>
16+
17+
<fileSets>
18+
<!-- root folder -->
19+
<fileSet filtered="true">
20+
<directory/>
21+
<includes>
22+
<include>manifest.yml</include>
23+
</includes>
24+
</fileSet>
25+
26+
<fileSet filtered="false">
27+
<directory/>
28+
<includes>
29+
<include>__gitignore__</include>
30+
<include>Jenkinsfile</include>
31+
<include>.pipeline/config.yml</include>
32+
</includes>
33+
</fileSet>
34+
35+
<!-- application folder -->
36+
<fileSet filtered="true">
37+
<directory>application</directory>
38+
<includes>
39+
<include>pom.xml</include>
40+
</includes>
41+
</fileSet>
42+
43+
<fileSet filtered="true">
44+
<directory>application/src</directory>
45+
<includes>
46+
<include>**/*.java</include>
47+
</includes>
48+
</fileSet>
49+
<fileSet filtered="true">
50+
<directory>application/src/main/resources</directory>
51+
<includes>
52+
<include>**</include>
53+
</includes>
54+
</fileSet>
55+
<fileSet filtered="true">
56+
<directory>application/src/test/resources</directory>
57+
<includes>
58+
<include>**</include>
59+
</includes>
60+
</fileSet>
61+
</fileSets>
62+
</archetype-descriptor>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
**/credentials.*
2+
**/target/
3+
/s4hana_pipeline
4+
**/*.log
5+
**/*.trc
6+
**/.settings/
7+
**/.project
8+
**/.classpath
9+
**/.idea
10+
**/*.iml
11+
**/.vscode
12+
**/node_modules
13+
**/.DS_Store
14+
.pipeline/commonPipelineEnvironment
Lines changed: 244 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,244 @@
1+
<?xml version='1.0' encoding='utf-8'?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
4+
<modelVersion>4.0.0</modelVersion>
5+
6+
<name>${artifactId} - Application</name>
7+
<description>${artifactId} - Application</description>
8+
9+
<artifactId>${artifactId}-application</artifactId>
10+
<version>${version}</version>
11+
12+
<parent>
13+
<groupId>${groupId}</groupId>
14+
<artifactId>${artifactId}</artifactId>
15+
<version>${version}</version>
16+
</parent>
17+
18+
<properties>
19+
<surefire.skipTests>false</surefire.skipTests>
20+
<surefire.forkCount>1</surefire.forkCount>
21+
<surefire.include>*</surefire.include>
22+
<surefire.exclude />
23+
<surefire.groups />
24+
<surefire.excludedGroups />
25+
<surefire.maxMemorySize>1024m</surefire.maxMemorySize>
26+
<surefire.logLevel>info</surefire.logLevel>
27+
28+
<!--
29+
Use the argLine property to define the arguments for the JVMs that are forked by the surefire plugin.
30+
This avoids the need to use late property evaluation for configuring the jacoco plugin.
31+
Relying on late evaluation of properties such as @{argLine} can result in issues with certain IDEs.
32+
33+
For more details, visit:
34+
https://www.eclemma.org/jacoco/trunk/doc/prepare-agent-mojo.html
35+
-->
36+
<argLine>-Xmx${surefire.maxMemorySize} -Dorg.slf4j.simpleLogger.defaultLogLevel=${surefire.logLevel}</argLine>
37+
38+
<jacoco.executionDataFile>${project.build.directory}/coverage-reports/jacoco.exec</jacoco.executionDataFile>
39+
<jacoco.includes>*</jacoco.includes>
40+
<jacoco.excludes>org.apache.*</jacoco.excludes>
41+
</properties>
42+
43+
<dependencies>
44+
<dependency>
45+
<groupId>com.sap.cloud.sdk</groupId>
46+
<artifactId>sdk-core</artifactId>
47+
</dependency>
48+
49+
<dependency>
50+
<groupId>org.slf4j</groupId>
51+
<artifactId>slf4j-api</artifactId>
52+
</dependency>
53+
<dependency>
54+
<groupId>ch.qos.logback</groupId>
55+
<artifactId>logback-classic</artifactId>
56+
</dependency>
57+
<dependency>
58+
<groupId>com.sap.hcp.cf.logging</groupId>
59+
<artifactId>cf-java-logging-support-logback</artifactId>
60+
<version>3.7.1</version>
61+
</dependency>
62+
<dependency>
63+
<groupId>org.springframework.boot</groupId>
64+
<artifactId>spring-boot-starter-webmvc</artifactId>
65+
</dependency>
66+
<dependency>
67+
<groupId>org.springframework.boot</groupId>
68+
<artifactId>spring-boot-web-server</artifactId>
69+
</dependency>
70+
71+
<!-- Dependencies for generated OData V4 VDM -->
72+
<!--
73+
<dependency>
74+
<groupId>com.sap.cloud.sdk.datamodel</groupId>
75+
<artifactId>odata-v4-core</artifactId>
76+
</dependency>
77+
<dependency>
78+
<groupId>org.projectlombok</groupId>
79+
<artifactId>lombok</artifactId>
80+
<scope>provided</scope>
81+
</dependency>
82+
-->
83+
84+
<!-- Dependencies for security setup -->
85+
<!--
86+
<dependency>
87+
<groupId>org.springframework.boot</groupId>
88+
<artifactId>spring-boot-starter-security</artifactId>
89+
</dependency>
90+
<dependency>
91+
<groupId>com.sap.cloud.security</groupId>
92+
<artifactId>resourceserver-security-spring-boot-starter</artifactId>
93+
</dependency>
94+
-->
95+
96+
<dependency>
97+
<groupId>org.junit.jupiter</groupId>
98+
<artifactId>junit-jupiter-api</artifactId>
99+
<scope>test</scope>
100+
</dependency>
101+
<dependency>
102+
<groupId>org.springframework</groupId>
103+
<artifactId>spring-test</artifactId>
104+
<scope>test</scope>
105+
</dependency>
106+
<dependency>
107+
<groupId>org.springframework.boot</groupId>
108+
<artifactId>spring-boot-test</artifactId>
109+
<scope>test</scope>
110+
</dependency>
111+
<dependency>
112+
<groupId>org.springframework.boot</groupId>
113+
<artifactId>spring-boot-test-autoconfigure</artifactId>
114+
<scope>test</scope>
115+
</dependency>
116+
<!-- Provides MockMvc test auto-configuration (e.g. @AutoConfigureMockMvc), split into its own module in Spring Boot 4. -->
117+
<dependency>
118+
<groupId>org.springframework.boot</groupId>
119+
<artifactId>spring-boot-webmvc-test</artifactId>
120+
<scope>test</scope>
121+
</dependency>
122+
<dependency>
123+
<groupId>org.springframework.security</groupId>
124+
<artifactId>spring-security-test</artifactId>
125+
<scope>test</scope>
126+
</dependency>
127+
<!-- Dependencies for security setup -->
128+
<!--
129+
<dependency>
130+
<groupId>com.sap.cloud.security</groupId>
131+
<artifactId>java-security-test</artifactId>
132+
<scope>test</scope>
133+
</dependency>
134+
-->
135+
136+
<dependency>
137+
<groupId>org.skyscreamer</groupId>
138+
<artifactId>jsonassert</artifactId>
139+
<version>1.5.1</version>
140+
<scope>test</scope>
141+
<exclusions>
142+
<!-- exclude android-json to avoid conflict with org.json:json -->
143+
<!-- see also: https://github.com/spring-projects/spring-boot/issues/8706 -->
144+
<exclusion>
145+
<groupId>com.vaadin.external.google</groupId>
146+
<artifactId>android-json</artifactId>
147+
</exclusion>
148+
</exclusions>
149+
</dependency>
150+
</dependencies>
151+
152+
<build>
153+
<finalName>${project.artifactId}</finalName>
154+
<plugins>
155+
<plugin>
156+
<groupId>org.springframework.boot</groupId>
157+
<artifactId>spring-boot-maven-plugin</artifactId>
158+
<version>${spring-boot.version}</version>
159+
<configuration>
160+
<attach>false</attach>
161+
</configuration>
162+
<executions>
163+
<execution>
164+
<goals>
165+
<goal>repackage</goal>
166+
</goals>
167+
</execution>
168+
</executions>
169+
</plugin>
170+
171+
<plugin>
172+
<groupId>org.jacoco</groupId>
173+
<artifactId>jacoco-maven-plugin</artifactId>
174+
<version>0.8.13</version>
175+
<configuration>
176+
<destFile>${jacoco.executionDataFile}</destFile>
177+
<dataFile>${jacoco.executionDataFile}</dataFile>
178+
<includes>${jacoco.includes}</includes>
179+
<excludes>${jacoco.excludes}</excludes>
180+
</configuration>
181+
<executions>
182+
<execution>
183+
<id>prepare-agent</id>
184+
<goals>
185+
<goal>prepare-agent</goal>
186+
</goals>
187+
</execution>
188+
</executions>
189+
</plugin>
190+
191+
<plugin>
192+
<groupId>org.apache.maven.plugins</groupId>
193+
<artifactId>maven-surefire-plugin</artifactId>
194+
<version>3.1.0</version>
195+
<configuration>
196+
<skipTests>${surefire.skipTests}</skipTests>
197+
<includes>
198+
<include>${surefire.include}</include>
199+
</includes>
200+
<excludes>
201+
<exclude>${surefire.exclude}</exclude>
202+
</excludes>
203+
<forkCount>${surefire.forkCount}</forkCount>
204+
<reuseForks>false</reuseForks>
205+
<groups>${surefire.groups}</groups>
206+
<excludedGroups>${surefire.excludedGroups}</excludedGroups>
207+
<systemPropertyVariables>
208+
<surefire.forkDir>${project.build.directory}/surefire-fork/${surefire.forkNumber}/
209+
</surefire.forkDir>
210+
</systemPropertyVariables>
211+
</configuration>
212+
</plugin>
213+
214+
<!-- Plugin for generating Java classes from OData V4 metadata -->
215+
<!-- Have a look into our documentation for more details as well as the OData V2 generator: -->
216+
<!-- https://sap.github.io/cloud-sdk/docs/java/features/odata/vdm-generator -->
217+
<!--
218+
<plugin>
219+
<groupId>com.sap.cloud.sdk.datamodel</groupId>
220+
<artifactId>odata-v4-generator-maven-plugin</artifactId>
221+
<version>${cloud-sdk.version}</version>
222+
<executions>
223+
<execution>
224+
<id>generate-consumption</id>
225+
<phase>generate-sources</phase>
226+
<goals>
227+
<goal>generate</goal>
228+
</goals>
229+
<configuration>
230+
<inputDirectory>${project.basedir}/src/main/resources/edmx</inputDirectory>
231+
<outputDirectory>${project.build.directory}/vdm</outputDirectory>
232+
<deleteOutputDirectory>true</deleteOutputDirectory>
233+
<packageName>${package}</packageName>
234+
<defaultBasePath>odata/v4/</defaultBasePath>
235+
<compileScope>COMPILE</compileScope>
236+
<serviceMethodsPerEntitySet>true</serviceMethodsPerEntitySet>
237+
</configuration>
238+
</execution>
239+
</executions>
240+
</plugin>
241+
-->
242+
</plugins>
243+
</build>
244+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#set( $symbol_pound = '#' )
2+
#set( $symbol_dollar = '$' )
3+
#set( $symbol_escape = '\' )
4+
package ${package};
5+
6+
import org.springframework.boot.SpringApplication;
7+
import org.springframework.boot.autoconfigure.SpringBootApplication;
8+
import org.springframework.boot.builder.SpringApplicationBuilder;
9+
import org.springframework.boot.web.server.servlet.context.ServletComponentScan;
10+
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
11+
import org.springframework.context.annotation.ComponentScan;
12+
13+
@SpringBootApplication
14+
@ComponentScan({"com.sap.cloud.sdk", "${package}"})
15+
@ServletComponentScan({"com.sap.cloud.sdk", "${package}"})
16+
public class Application extends SpringBootServletInitializer
17+
{
18+
@Override
19+
protected SpringApplicationBuilder configure( final SpringApplicationBuilder application )
20+
{
21+
return application.sources(Application.class);
22+
}
23+
24+
public static void main( final String[] args )
25+
{
26+
SpringApplication.run(Application.class, args);
27+
}
28+
}

0 commit comments

Comments
 (0)