Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# MoC Java Client Usage Guide

このドキュメントでは、MoC Java クライアントライブラリを Maven と Gradle で使用する方法について説明します。

## Maven での使用方法

Maven プロジェクトで MoC Java クライアントを使用するには、`pom.xml` に以下の依存関係を追加してください:

```xml
<dependency>
<groupId>city.makeour</groupId>
<artifactId>moc</artifactId>
<version>1.0.0</version>
</dependency>
```

## Gradle での使用方法

Gradle プロジェクトで MoC Java クライアントを使用するには、`build.gradle` に以下の依存関係を追加してください:

### Gradle (Groovy DSL)

```groovy
implementation 'city.makeour:moc:1.0.0'
```

### Gradle (Kotlin DSL)

```kotlin
implementation("city.makeour:moc:1.0.0")
```

## 基本的な使用例

```java
import city.makeour.moc.MocClient;

public class Example {
public static void main(String[] args) {
// クライアントの初期化
MocClient client = new MocClient();

// 認証情報の設定
client.setMocAuthInfo("your-cognito-user-pool-id", "your-cognito-client-id");

// 認証
client.auth("username", "password");

// エンティティの操作
// 詳細は examples ディレクトリのサンプルコードを参照してください
}
}
```

詳細な使用例については、[examples ディレクトリ](./src/main/java/city/makeour/moc/examples/)を参照してください。

## Maven Central Repository への公開

このライブラリは Maven Central Repository で公開されており、追加のリポジトリ設定なしで使用できます。

## ライセンス

このライブラリは MIT ライセンスの下で公開されています。詳細については、[LICENSE](./LICENSE) ファイルを参照してください。
94 changes: 94 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
plugins {
id 'java-library'
id 'maven-publish'
id 'signing'
}

group = 'city.makeour'
version = '1.0.0'
sourceCompatibility = '17'
targetCompatibility = '17'

repositories {
mavenCentral()
maven { url "https://jitpack.io" }
}

dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.2'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.1'
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.10.1'
testImplementation 'org.mockito:mockito-junit-jupiter:5.3.1'

implementation 'software.amazon.awssdk:cognitoidentityprovider:2.31.20'
implementation 'com.github.makeOurCity:ngsiv2-java:0.0.2'
implementation 'org.bouncycastle:bcprov-jdk15on:1.70'
implementation 'org.springframework:spring-webmvc:5.3.23'
}

java {
withJavadocJar()
withSourcesJar()
}

test {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed"
}
}

publishing {
publications {
mavenJava(MavenPublication) {
from components.java

pom {
name = 'MoC Java Client'
description = 'MakeOurCity (MoC) client library for Java'
url = 'https://github.com/makeOurCity/moc-java'

licenses {
license {
name = 'MIT License'
url = 'https://opensource.org/licenses/MIT'
}
}

developers {
developer {
name = 'MakeOurCity Team'
email = 'info@makeour.city'
organization = 'MakeOurCity'
organizationUrl = 'https://makeour.city'
}
}

scm {
connection = 'scm:git:git://github.com/makeOurCity/moc-java.git'
developerConnection = 'scm:git:ssh://github.com:makeOurCity/moc-java.git'
url = 'https://github.com/makeOurCity/moc-java'
}
}
}
}

repositories {
maven {
name = "OSSRH"
def releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl

credentials {
username = System.getenv("OSSRH_USERNAME") ?: project.findProperty("ossrhUsername")
password = System.getenv("OSSRH_PASSWORD") ?: project.findProperty("ossrhPassword")
}
}
}
}

signing {
required { !version.endsWith('SNAPSHOT') && gradle.taskGraph.hasTask("publish") }
sign publishing.publications.mavenJava
}
109 changes: 103 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,37 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>


<groupId>city.makeour</groupId>
<artifactId>moc</artifactId>
<version>1.0-SNAPSHOT</version>
<version>1.0.0</version>
<packaging>jar</packaging>

<name>MoC Java Client</name>
<description>MakeOurCity (MoC) client library for Java</description>
<url>https://github.com/makeOurCity/moc-java</url>

<licenses>
<license>
<name>MIT License</name>
<url>https://opensource.org/licenses/MIT</url>
<distribution>repo</distribution>
</license>
</licenses>

<developers>
<developer>
<name>MakeOurCity Team</name>
<email>info@makeour.city</email>
<organization>MakeOurCity</organization>
<organizationUrl>https://makeour.city</organizationUrl>
</developer>
</developers>

<name>moc</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url>
<scm>
<connection>scm:git:git://github.com/makeOurCity/moc-java.git</connection>
<developerConnection>scm:git:ssh://github.com:makeOurCity/moc-java.git</developerConnection>
<url>https://github.com/makeOurCity/moc-java</url>
</scm>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down Expand Up @@ -73,6 +96,17 @@
</dependency>
</dependencies>

<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>

<build>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>
Expand Down Expand Up @@ -122,5 +156,68 @@
</plugin>
</plugins>
</pluginManagement>
<plugins>
<!-- Javadoc and Sources attachments -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.4.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- GPG Signing -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
<configuration>
<!-- Prevent gpg from using pinentry programs -->
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
</configuration>
</execution>
</executions>
</plugin>
<!-- Nexus Staging Plugin -->
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.13</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
</plugins>
</build>
</project>
</project>
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rootProject.name = 'moc'