optimizely / optimizely/java-sdk
[BUG] Required dependency missing: org.json:json
まだ誰も着手していません。
- 主要言語
- Java
- スター
- 44
- フォーク
- 32
- 平均マージ
- 8時間 39分
- マージ済み PR(30日)
- 1
説明
Is there an existing issue for this?
- I have searched the existing issues
SDK Version
<dependency>
<groupId>com.optimizely.ab</groupId>
<artifactId>core-api</artifactId>
<version>4.1.1</version>
</dependency>
Current Behavior
Using JsonConfigParser leads to runtime exception, because it requires org.json.JsonObject from org.json:json which is not provided as an implementation dependency.
JsonConfigParser https://github.com/optimizely/java-sdk/blob/master/core-api/src/main/java/com/optimizely/ab/config/parser/JsonConfigParser.java
Dependency excluded here: https://github.com/optimizely/java-sdk/blob/master/core-api/build.gradle#L11
Expected Behavior
Users of your library should be able to use JsonConfigParser without knowing about its internal dependencies.
Steps To Reproduce
Create a Project with
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<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">
<modelVersion>4.0.0</modelVersion>
<artifactId>repro</artifactId>
<groupId>repro</groupId>
<version>1.0.0</version>
<dependencies>
<dependency>
<groupId>com.optimizely.ab</groupId>
<artifactId>core-api</artifactId>
<version>4.1.1</version>
</dependency>
</dependencies>
</project>
and settings.xml
<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
https://maven.apache.org/xsd/settings-1.0.0.xsd">
</settings>
and src/main/java/Main.java
import com.optimizely.ab.config.parser.ConfigParseException;
import com.optimizely.ab.config.parser.JsonConfigParser;
public class Main {
public static void main(String[] args) {
System.out.println("Hello, World!");
JsonConfigParser parser = new JsonConfigParser();
try {
parser.parseProjectConfig("{}");
} catch (ConfigParseException e) {
e.printStackTrace();
}
}
}
% mvn clean compile
% mvn exec:java -Dexec.mainClass=Main
Java Version
% mvn -version
Apache Maven 3.9.9 (8e8579a9e76f7d015ee5ec7bfcdc97d260186937)
Maven home: /usr/local/Cellar/maven/3.9.9/libexec
Java version: 11.0.22, vendor: Amazon.com Inc.
Link
No response
Logs
No response
Severity
No response
Workaround/Solution
Solution
Change https://github.com/optimizely/java-sdk/blob/master/core-api/build.gradle#L11
from compileOnly to implementation
Alternatively, do not expose JsonConfigParser to consumers of your library.
Recent Change
No response
Conflicts
No response
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
core-api/build.gradle の 11 行目から始め、JsonConfigParser 用の org.json 依存関係がどのように宣言されているかを確認します。core-api バージョン 4.1.1 で報告された Maven の再現手順を実行し、その後、利用者が org.json を自分で宣言せずに JsonConfigParser を実行できることを検証します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- java
- 領域
- build-system
- issue の種類
- バグ
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 35/100