Skip to content

Commit 54e26ec

Browse files
Rob Tjalmadlabordus
authored andcommitted
Removed Gradle, replaced with Maven
Signed-off-by: Rob Tjalma <[email protected]>
1 parent 8cf8b53 commit 54e26ec

File tree

1 file changed

+51
-20
lines changed

1 file changed

+51
-20
lines changed

CONTRIBUTING.md

Lines changed: 51 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -177,30 +177,61 @@ See below how to do both action for the specific tools.
177177
To use Github Packages a username and token is needed. The username is your Github username. The token can be genreate in Github by going to your settings, Developer settings, Personal access tokens.
178178
Generate a new token here and make sure that the scope "read:packages" is enabled. Use this token below to configure the build tools.
179179

180-
#### Basic Gradle
181-
The project uses Gradle to manage the build. Most projects use multi-module structures to build all code. A basic command to run gradle is:
180+
#### Basic Maven
181+
The project uses Maven to manage the build. Most projects use multi-module structures to build all code. A basic command to run Maven is:
182182
```
183-
$ gradle build
183+
$ maven clean verify
184184
```
185-
#### Github Packages in Gradle
186-
To use Github Packages in Gradle an extra repository need to be added to the build process.
185+
#### Github Packages in Maven
186+
To use Github Packages in Maven an extra repository need to be added to the build process.
187187
```
188-
repositories {
189-
...
190-
maven {
191-
name = "GitHubPackages"
192-
url = uri("https://maven.pkg.github.com/com-pas/*")
193-
credentials {
194-
username = project.hasProperty('githubUsername') ? project.getProperty("githubUsername") : System.getenv("GITHUB_USERNAME")
195-
password = project.hasProperty('githubToken') ? project.getProperty("githubToken") : System.getenv("GITHUB_TOKEN")
196-
}
197-
}
198-
...
199-
}
188+
<repositories>
189+
<repository>
190+
<id>github-packages-compas</id>
191+
<name>Github Packages CoMPAS</name>
192+
<url>https://maven.pkg.github.com/com-pas/*</url>
193+
</repository>
194+
</repositories>
200195
```
201-
Because credentials are needed for Github Packages these can be passed in 2 different ways.
202-
- First solution is to added the properties "githubUsername" and "githubToken" to your gradle.properties in your home directory (~/.gradle/gradle.properties). This solution doesn't seem to work with Intellij IDEA.
203-
- The second solution is to create two environment properties "GITHUB_USERNAME" and "GITHUB_TOKEN". This ones is also used by Github Actions.
196+
Because credentials are needed for Github Packages, these will be passed by using the Settings.xml file.
197+
198+
##### Local Settings.xml
199+
Edit (or create if not already exists) the `~/.m2/settings.xml` file and add the following content:
200+
```xml
201+
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
202+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
203+
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
204+
http://maven.apache.org/xsd/settings-1.0.0.xsd">
205+
206+
<servers>
207+
<server>
208+
<id>github-packages-compas</id>
209+
<username>username</username>
210+
<password>password</password>
211+
</server>
212+
</servers>
213+
214+
</settings>
215+
```
216+
Add this server section. The ID of the server must be the same as the ID found in the previous repository ID, it should map.
217+
Username should be your Github username, password can both be your own [encrypted password](https://maven.apache.org/guides/mini/guide-encryption.html)
218+
or a [Personal Access Token](https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token).
219+
220+
##### Settings.xml during Github Action
221+
During multiple Github Actions (like building and SonarCloud analysis), the `settings.xml` file is also needed because it needs access to the Github Packages
222+
to download certain artifacts. We can do this by adding the following step **before** the Github Packages is needed:
223+
```yaml
224+
- name: Create custom Maven Settings.xml
225+
uses: whelk-io/maven-settings-xml-action@v18
226+
with:
227+
output_file: custom_maven_settings.xml
228+
servers: '[{ "id": "github-packages-compas", "username": "OWNER", "password": "${{ secrets.GITHUB_TOKEN }}" }]'
229+
```
230+
This basically creates a custom `settings.xml` at location `custom_maven_settings.xml`. This file can be passed to maven in the next step
231+
by using `mvn -s custom_maven_settings.xml` and perhaps some extra parameters you wish for.
232+
233+
For the `servers` part, we again have the `github-packages-compas` ID that needs to be the same. We have an `OWNER` username (this is the default, because
234+
it needs to have a username) and a password which is the GITHUB_TOKEN that's always available.
204235

205236
#### Basic Maven Usage
206237
The project uses maven to manage the build. The configuration of all the tools is fairly standard, so if you have already contributed to Java projects, you should feel right at home. You can safely run the full test suite, checkstyle, see code coverage information and the generated documentation with the following command:

0 commit comments

Comments
 (0)