Skip to content

Commit 3d85931

Browse files
author
Sergio Andres Mejia Tovar
committed
[WIT-2944] Publish java tech adapter framework to maven central
# New features and improvements * Added Maven profile to publish artifacts on Sonatype Central with all necessary plugins * Reintroduces the publish step on the CI # Related issue Closes WIT-2944 # Definition of Done So you are going to put your MR in review, but are you sure you have done all things listed here? ## All Developments - [ ] **Feature was implemented as per the requirements** - [ ] **If some code parts are complex they must be commented with code documentation** - [ ] **Unit, integration and E2E tests have been performed and code coverage is not reduced**, so that new code is covered - [ ] **CI/CD is successful** - [ ] **Exceptions and errors are handled, returning meaningful errors to the user**, without letting the underlying framework to respond with a generic Internal Server Error. Technical details are stored in the errors/problems and not in the user message - [ ] **Documentation (user documentation, HLD and others) has been updated** - Documentation has been updated with explanation of the new feature if it's user-facing (e.g. component now has additional setting) or it impacts them in some other way (e.g. optional field that becomes mandatory) - If it is a breaking change, we have documented it as such in the MR description in a "Breaking Changes" section - [ ] **Helm chart and other DevOps artifacts** have been updated and are valid deployment tools for the new version - [ ] **Problematic information (sensitive information, credentials, customer information or other intellectual property) is not included in the changes** as they could end up being public (most SPs are already published and automatically mirrored on every merge) - [ ] **Feature doesn't negatively affect any existing environments**, especially the clients Playgrounds. This means that merging it to master and deploying it to these environments will not break them and **no manual operations that are not reported in the documentation will be needed** - [ ] **If dependencies were changed, be sure that they will not impact the project**, that their license is compatible, and that they introduce no vulnerabilities - [ ] **Security, Authentication and Authorization have been considered**. No SQL injection, tokens handling, RBAC integration. Common security vulnerabilities identified and resolved - [ ] **The Java Scaffold is updated to support and test the new features**, especially if they're breaking changes ## API related Development - [ ] **API Parameters and return body are compliant** with the API specification - [ ] **Errors are correctly handled**, respecting the type of errors return bodies and responses for each endpoint - [ ] **API is logging in compliance with audit standards**, presence of sensitive information for GDPR has been assessed and removed or managed in case is needed ## DB related Development - [ ] **The database schema is designed to accurately** represent the data model and meet the requirements - [ ] **Tables, relationships, and constraints (e.g. primary keys, foreign keys, unique constraints) are defined appropriately**, following best practices and a common naming convention - [ ] **Sensitive data is stored securely**, encrypted if required, and access is restricted to authorized users - [ ] **Migration scripts to upgrade and downgrade the database have been implemented and tested**
1 parent 1c5332f commit 3d85931

File tree

6 files changed

+251
-13
lines changed

6 files changed

+251
-13
lines changed

.gitlab-ci.yml

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ include:
55
- template: Security/SAST.gitlab-ci.yml
66
- template: Security/Secret-Detection.gitlab-ci.yml
77

8-
image: maven:3.9.4-eclipse-temurin-17
8+
image: maven:3.9-eclipse-temurin-17
99

1010
variables:
11-
MAVEN_CLI_OPTS: "--batch-mode"
11+
MAVEN_CLI_OPTS: "-s ci_settings.xml --batch-mode"
1212
MAVEN_OPTS: "-Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository -Drevision=$VERSION"
1313

1414
cache:
@@ -31,7 +31,7 @@ setup:
3131
script:
3232
- !reference [.witboost.helm.clone-scripts, script]
3333
- !reference [.witboost.helm.get-version, script]
34-
- echo "VERSION=${VERSION}" >> vars.env
34+
- echo "VERSION=${VERSION}-2.2.0" >> vars.env
3535
artifacts:
3636
reports:
3737
dotenv: vars.env
@@ -143,13 +143,30 @@ coverage-jdk17:
143143

144144
package:
145145
stage: package
146+
before_script:
147+
- apt-get update
148+
- apt-get install gnupg -y
146149
script:
147-
- mvn -DskipTests=true $MAVEN_CLI_OPTS package
150+
- echo -n "$MAVEN_GPG_KEY" | base64 -d | gpg --batch --import
151+
- mvn -DskipTests=true $MAVEN_CLI_OPTS -P release,sources-and-javadoc package
148152
artifacts:
149153
paths:
150-
- common/target/*.jar
154+
- target/*.jar
155+
- core/*.jar
156+
- model/*.jar
151157

152-
#publish:
153-
# stage: publish
154-
# script:
155-
# - mvn -DskipTests=true deploy -s ci_settings.xml
158+
publish:
159+
stage: publish
160+
before_script:
161+
- apt-get update
162+
- apt-get install gnupg -y
163+
script:
164+
- echo -n "$MAVEN_GPG_KEY" | base64 -d | gpg --batch --import
165+
- mvn -DskipTests=true $MAVEN_CLI_OPTS -P release,sources-and-javadoc deploy
166+
only:
167+
- tags
168+
169+
publish-gitlab:
170+
stage: publish
171+
script:
172+
- mvn -DskipTests=true $MAVEN_CLI_OPTS -P gitlab,sources-and-javadoc deploy

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,14 @@ Add the following on your `pom.xml`:
107107
<dependency>
108108
<groupId>com.witboost.provisioning</groupId>
109109
<artifactId>java-tech-adapter-framework-core</artifactId>
110-
<version>X.X.X</version>
110+
<version>X.X.X-Y.Y.Y</version>
111111
</dependency>
112112
</dependencies>
113113
...
114114
</project>
115115
```
116116

117-
Where `X.X.X` is the library version you desire to use.
117+
Where `X.X.X-Y.Y.Y` is the library version you desire to use. See [Publishing](#publishing) for more information about this versions.
118118

119119
### Implementing server logic
120120

@@ -181,6 +181,10 @@ mvn package
181181

182182
**CI/CD:** the pipeline is based on GitLab CI as that's what we use internally. It's configured by the `.gitlab-ci.yaml` file in the root of the repository. You can use that as a starting point for your customizations.
183183

184+
## Publishing
185+
186+
Publishing is done via Maven publishing to internal Gitlab repositories and to Maven Central. We use a combination of semantic versioning, containing a version of the framework followed by the supported Tech Adapter OpenAPI specification. This way, a specific version of a framework may look like: `1.0.0-2.2.0`. This means, that the version `1.0.0` of the Java Tech Adapter Framework supports the version `2.2.0` of the Tech Adapter OpenAPI specification.
187+
184188
## License
185189

186190
This project is available under the [Apache License, Version 2.0](https://opensource.org/licenses/Apache-2.0); see [LICENSE](LICENSE) for full details.

RELEASE_NOTES.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
## v2.2.0
6+
7+
### Commits
8+
9+
- **[WIT-2983] Add support for data contract and tags on java framework**
10+
>
11+
> ##### New features and improvements
12+
>
13+
> * Introduces Data Contract and Tag model classes to better parse the input entities
14+
> * Introduces the field `additionalProperties` to most model classes to store the non-parsed fields (e.g. custom fields added to a certain base Component)
15+
>
16+
> ##### Related issue
17+
>
18+
> Closes WIT-2983
19+
>
20+
>
21+
22+
- **[WIT-2829] Implement the sync java tech adapter framework**
23+
>
24+
> ##### New features and improvements
25+
>
26+
> * Implements support for synchronous validation, provisioning, unprovisioning, update ACL and reverse provisioning on the framework
27+
> * Provides autoconfiguration for ProvisionConfiguration and ValidationConfiguration classes with a failure behaviour, overridable by the user.
28+
> * Provides `ComponentClassProviderImpl` and `SpecificClassProviderImpl` as base implementations of their interfaces to easily bootstrap simple use-cases Tech Adapters.
29+
> * Provides a guide on how to bootstrap a brand new Tech Adapter, and how to migrate existing Tech Adapters that are based on the old Java Scaffold project.
30+
>
31+
> ##### Related issue
32+
>
33+
> Closes WIT-2829
34+
>
35+
>
36+
37+
- **[WIT-2828] Bootstrap Java Tech Adapter Framework**
38+
>
39+
> ##### New features and improvements
40+
>
41+
> * Bootstraps the Framework by using the Java Scaffold code
42+
> * Separates the project into two modules, core and model
43+
>
44+
> ##### Related issue
45+
>
46+
> Closes WIT-2828
47+
>
48+
>
49+
50+
- **[WIT-2827] Java Tech Adapter Framework LLD**
51+
>
52+
> ##### New features and improvements
53+
>
54+
> * Adds the Low Level Design documentation
55+
>
56+
> ##### Related issue
57+
>
58+
> Closes WIT-2827
59+
>
60+
>
61+
62+
- **[WIT-2826] Java Tech Adapter Framework HLD**
63+
>
64+
> ##### New features and improvements
65+
>
66+
> * Added framework HLD
67+
>
68+
> ##### Related issue
69+
>
70+
> Closes WIT-2826
71+
>
72+
>
73+
74+
- **Add README**

ci_settings.xml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<settings xmlns="http://maven.apache.org/SETTINGS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
3+
<servers>
4+
<server>
5+
<id>central</id>
6+
<username>${SONATYPE_USER}</username>
7+
<password>${SONATYPE_PASSWORD}</password>
8+
</server>
9+
<server>
10+
<id>gpg.passphrase</id>
11+
<passphrase>${MAVEN_GPG_PASSPHRASE}</passphrase>
12+
</server>
13+
<server>
14+
<id>gitlab-maven</id>
15+
<configuration>
16+
<httpHeaders>
17+
<property>
18+
<name>Job-Token</name>
19+
<value>${CI_JOB_TOKEN}</value>
20+
</property>
21+
</httpHeaders>
22+
</configuration>
23+
</server>
24+
</servers>
25+
</settings>

docs/usage.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ To start working with the Java Tech Adapter Framework, add the following to you
2525
<dependency>
2626
<groupId>com.witboost.provisioning</groupId>
2727
<artifactId>java-tech-adapter-framework-core</artifactId>
28-
<version>X.X.X</version>
28+
<version>X.X.X-Y.Y.Y</version>
2929
</dependency>
3030
</dependencies>
3131
...
3232
</project>
3333
```
3434

35-
Where `X.X.X` is the desired version of the framework.
35+
Where `X.X.X-Y.Y.Y` is the desired version of the framework. See [Publishing](../README.md#publishing) for more information about versioning.
3636

3737
## Bootstrapping your Tech Adapter
3838

pom.xml

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,4 +229,122 @@
229229
</pluginRepository>
230230
</pluginRepositories>
231231

232+
<profiles>
233+
<profile>
234+
<id>sources-and-javadoc</id>
235+
<build>
236+
<plugins>
237+
<plugin>
238+
<groupId>org.apache.maven.plugins</groupId>
239+
<artifactId>maven-source-plugin</artifactId>
240+
<version>2.2.1</version>
241+
<executions>
242+
<execution>
243+
<id>attach-sources</id>
244+
<goals>
245+
<goal>jar-no-fork</goal>
246+
</goals>
247+
</execution>
248+
</executions>
249+
</plugin>
250+
<plugin>
251+
<groupId>org.apache.maven.plugins</groupId>
252+
<artifactId>maven-javadoc-plugin</artifactId>
253+
<version>3.10.0</version>
254+
<executions>
255+
<execution>
256+
<id>attach-javadocs</id>
257+
<goals>
258+
<goal>aggregate-jar</goal>
259+
</goals>
260+
</execution>
261+
</executions>
262+
<configuration>
263+
<doclint>all,-missing</doclint>
264+
<tags>
265+
<tag>
266+
<name>apiNote</name>
267+
<placement>a</placement>
268+
<head>API Note:</head>
269+
</tag>
270+
<tag>
271+
<name>implSpec</name>
272+
<placement>a</placement>
273+
<head>Implementation Requirements:</head>
274+
</tag>
275+
<tag>
276+
<name>implNote</name>
277+
<placement>a</placement>
278+
<head>Implementation Note:</head>
279+
</tag>
280+
<tag><name>param</name></tag>
281+
<tag><name>return</name></tag>
282+
<tag><name>throws</name></tag>
283+
<tag><name>since</name></tag>
284+
<tag><name>version</name></tag>
285+
<tag><name>serialData</name></tag>
286+
<tag><name>see</name></tag>
287+
</tags>
288+
</configuration>
289+
</plugin>
290+
</plugins>
291+
</build>
292+
</profile>
293+
<profile>
294+
<id>release</id>
295+
<build>
296+
<plugins>
297+
<plugin>
298+
<groupId>org.apache.maven.plugins</groupId>
299+
<artifactId>maven-gpg-plugin</artifactId>
300+
<version>3.2.4</version>
301+
<executions>
302+
<execution>
303+
<id>sign-artifacts</id>
304+
<phase>verify</phase>
305+
<goals>
306+
<goal>sign</goal>
307+
</goals>
308+
</execution>
309+
</executions>
310+
</plugin>
311+
<plugin>
312+
<groupId>org.sonatype.central</groupId>
313+
<artifactId>central-publishing-maven-plugin</artifactId>
314+
<version>0.5.0</version>
315+
<extensions>true</extensions>
316+
<configuration>
317+
<publishingServerId>central</publishingServerId>
318+
<autoPublish>false</autoPublish>
319+
</configuration>
320+
</plugin>
321+
</plugins>
322+
</build>
323+
</profile>
324+
325+
<profile>
326+
<id>gitlab</id>
327+
<repositories>
328+
<repository>
329+
<id>gitlab-maven</id>
330+
<!--suppress UnresolvedMavenProperty -->
331+
<url>${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/maven</url>
332+
</repository>
333+
</repositories>
334+
335+
<distributionManagement>
336+
<repository>
337+
<id>gitlab-maven</id>
338+
<!--suppress UnresolvedMavenProperty -->
339+
<url>${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/maven</url>
340+
</repository>
341+
<snapshotRepository>
342+
<id>gitlab-maven</id>
343+
<!--suppress UnresolvedMavenProperty -->
344+
<url>${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/maven</url>
345+
</snapshotRepository>
346+
</distributionManagement>
347+
</profile>
348+
</profiles>
349+
232350
</project>

0 commit comments

Comments
 (0)