Skip to content

Commit

Permalink
Maven configurations and updates (#2) (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
NuwanJ authored Jul 29, 2023
1 parent e8b3252 commit f075bc0
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 28 deletions.
31 changes: 16 additions & 15 deletions .github/workflows/java-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,23 @@ on:

jobs:
build:

runs-on: ubuntu-latest
permissions:
contents: read
packages: read

steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'

- name: Build with Maven
run: mvn -B package --file pom.xml
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file

- name: Build with Maven
run: mvn -s $GITHUB_WORKSPACE/.github/workflows/maven-settings.xml -B package --file pom.xml
env:
USER_NAME: ${{ secrets.USER_NAME }}
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
- name: Build with Maven
env:
USER_NAME: ${{ secrets.USER_NAME }}
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
run: mvn -s $GITHUB_WORKSPACE/.github/workflows/maven-settings.xml -B package --file pom.xml
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ hs_err_pid*
.idea
.target

/target
/target
settings.xml
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[![Java CI with Maven](https://github.com/Pera-Swarm/java-robot/actions/workflows/java-ci.yml/badge.svg)](https://github.com/Pera-Swarm/java-robot/actions/workflows/java-ci.yml)


# Java Robot

Expand Down Expand Up @@ -25,12 +27,14 @@ channel="v1"

## Install the Library

<!-- - You need to setup a GitHub Token with the scope of `read:packages` and save it along with your GitHub UserName as environment variables as follows:
- You need to setup a GitHub Token with the scope of `read:packages` and save it along with your GitHub UserName as environment variables as follows:

```bash
export USER_NAME="NuwanJ"
export ACCESS_TOKEN="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"
``` -->
```xml
<server>
<username>{GITHUB_USERNAME}</username>
<password>{GITHUB_TOKEN}</password>
</server>
```

- Run the following command to run the `mvn install`

Expand Down
14 changes: 7 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@
<artifactId>java-robot-node</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>

<distributionManagement>
<repository>
<id>github</id>
<name>GitHub OWNER Apache Maven Packages</name>
<url>https://maven.pkg.github.com/Pera-Swarm/java-robot</url>
<name>GitHub Pera-Swarm Apache Maven Packages</name>
<url>https://maven.pkg.github.com/Pera-Swarm/robot-library-java</url>
</repository>
</distributionManagement>

<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>pera.swarm</groupId>
Expand Down
38 changes: 38 additions & 0 deletions settings.sample.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<activeProfiles>
<activeProfile>github</activeProfile>
</activeProfiles>
<profiles>
<profile>
<id>github</id>
<repositories>
<repository>
<id>central</id>
<url>https://repo1.maven.org/maven2</url>
</repository>
<repository>
<id>github</id>
<url>https://maven.pkg.github.com/Pera-Swarm/java-robot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
</profile>
</profiles>

<servers>
<server>
<id>github</id>
<username>{GITHUB_USERNAME}</username>
<password>{GITHUB_TOKEN}</password>
</server>
</servers>

</settings>

0 comments on commit f075bc0

Please sign in to comment.