diff --git a/src/main/java/com/smartdoc/gradle/chain/CommonArtifactFilterChain.java b/src/main/java/com/smartdoc/gradle/chain/CommonArtifactFilterChain.java index 975cbea..fdf7d8d 100644 --- a/src/main/java/com/smartdoc/gradle/chain/CommonArtifactFilterChain.java +++ b/src/main/java/com/smartdoc/gradle/chain/CommonArtifactFilterChain.java @@ -1,5 +1,5 @@ /* - * smart-doc https://github.com/shalousun/smart-doc + * smart-doc https://github.com/smart-doc-group/smart-doc * * Copyright (C) 2018-2023 smart-doc * @@ -22,7 +22,6 @@ */ package com.smartdoc.gradle.chain; - import com.smartdoc.gradle.model.CustomArtifact; /** @@ -41,12 +40,6 @@ public void setNext(FilterChain nextInChain) { public boolean ignoreArtifactById(CustomArtifact artifact) { String artifactId = artifact.getArtifactId(); switch (artifactId) { - case "aspectjweaver": - case "fastjson": - case "fastjson2": - case "bcprov-jdk15on": - case "bcpkix-jdk15on": - case "lombok": case "jsqlparser": case "disruptor": case "snakeyaml": @@ -57,13 +50,15 @@ public boolean ignoreArtifactById(CustomArtifact artifact) { case "mysql-connector-j": case "classmate": case "commons-codec": - case "commons-lang3": - case "commons-text": case "commons-beanutils": case "commons-beanutils-core": case "spring-web": case "spring-webmvc": case "spring-r2dbc": + case "spring-orm": + case "spring-data-jpa": + case "spring-context-support": + case "spring-aspects": case "hibernate-validator": case "xstream": case "spring-tx": @@ -71,18 +66,27 @@ public boolean ignoreArtifactById(CustomArtifact artifact) { case "javafaker": case "qdox": case "gson": - case "netty-all": - case "javacv-platform": case "antlr4-runtime": - case "jetty": case "velocity": case "beetl": case "xml-apis": case "mchange-commons-java": - case "hadoop-common": case "druid": case "mssql-jdbc": case "easyexcel": + case "zookeeper": + case "okio": + case "okhttp": + case "joda-time": + case "protobuf-java": + case "jenkins-client": + case "jose4j": + case "gson-fire": + case "joda-convert": + case "kafka-clients": + case "kubernetes-client": + case "client-java-proto": + case "dynamic-datasource-spring-boot-starter": return true; default: return this.ignore(filterChain, artifact); diff --git a/src/main/java/com/smartdoc/gradle/chain/ContainsFilterChain.java b/src/main/java/com/smartdoc/gradle/chain/ContainsFilterChain.java index 65dc879..2270a38 100644 --- a/src/main/java/com/smartdoc/gradle/chain/ContainsFilterChain.java +++ b/src/main/java/com/smartdoc/gradle/chain/ContainsFilterChain.java @@ -1,5 +1,5 @@ /* - * smart-doc https://github.com/shalousun/smart-doc + * smart-doc https://github.com/smart-doc-group/smart-doc * * Copyright (C) 2018-2023 smart-doc * @@ -34,16 +34,18 @@ public class ContainsFilterChain implements FilterChain { private final static Set CONTAINS_SET = new HashSet<>(); - private FilterChain filterChain; - static { CONTAINS_SET.add("log4j"); CONTAINS_SET.add("logback"); CONTAINS_SET.add("slf4j"); CONTAINS_SET.add("swagger"); CONTAINS_SET.add("dom4j"); + CONTAINS_SET.add("jsr"); + CONTAINS_SET.add("jtds"); } + private FilterChain filterChain; + @Override public void setNext(FilterChain nextInChain) { this.filterChain = nextInChain; diff --git a/src/main/java/com/smartdoc/gradle/chain/FilterChain.java b/src/main/java/com/smartdoc/gradle/chain/FilterChain.java index 955bd3f..9258659 100644 --- a/src/main/java/com/smartdoc/gradle/chain/FilterChain.java +++ b/src/main/java/com/smartdoc/gradle/chain/FilterChain.java @@ -1,5 +1,5 @@ /* - * smart-doc https://github.com/shalousun/smart-doc + * smart-doc https://github.com/smart-doc-group/smart-doc * * Copyright (C) 2018-2023 smart-doc * diff --git a/src/main/java/com/smartdoc/gradle/chain/GroupIdFilterChain.java b/src/main/java/com/smartdoc/gradle/chain/GroupIdFilterChain.java new file mode 100644 index 0000000..893931b --- /dev/null +++ b/src/main/java/com/smartdoc/gradle/chain/GroupIdFilterChain.java @@ -0,0 +1,108 @@ +/* + * smart-doc https://github.com/smart-doc-group/smart-doc + * + * Copyright (C) 2018-2023 smart-doc + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.smartdoc.gradle.chain; + +import com.smartdoc.gradle.model.CustomArtifact; + +import java.util.HashSet; +import java.util.Set; + +/** + * @author yu 2023/5/10. + */ +public class GroupIdFilterChain implements FilterChain{ + + private final static Set GROUPID_SET = new HashSet<>(); + + static { + GROUPID_SET.add("org.apache.commons"); + GROUPID_SET.add("io.fabric8"); + GROUPID_SET.add("io.kubernetes"); + GROUPID_SET.add("org.jooq"); + GROUPID_SET.add("org.mortbay.jetty"); + GROUPID_SET.add("com.google.http-client"); + GROUPID_SET.add("jakarta.xml.bind"); + GROUPID_SET.add("org.mariadb.jdbc"); + GROUPID_SET.add("jakarta.transaction"); + GROUPID_SET.add("jakarta.persistence"); + GROUPID_SET.add("javax.servlet"); + GROUPID_SET.add("io.projectreactor"); + GROUPID_SET.add("org.mapstruct"); + GROUPID_SET.add("io.sundr"); + GROUPID_SET.add("org.aspectj"); + GROUPID_SET.add("org.slf4j"); + GROUPID_SET.add("com.esotericsoftware.yamlbeans"); + GROUPID_SET.add("jakarta.activation"); + GROUPID_SET.add("commons-httpclient"); + GROUPID_SET.add("org.apache.curator"); + GROUPID_SET.add("org.apache.hive"); + GROUPID_SET.add("org.apache.hadoop"); + GROUPID_SET.add("org.hibernate"); + GROUPID_SET.add("org.bouncycastle"); + GROUPID_SET.add("io.vavr"); + GROUPID_SET.add("org.projectlombok"); + GROUPID_SET.add("org.freemarker"); + GROUPID_SET.add("com.auth0"); + GROUPID_SET.add("org.apache.logging.log4j"); + GROUPID_SET.add("com.google.protobuf"); + GROUPID_SET.add("org.postgresql"); + GROUPID_SET.add("com.microsoft.sqlserver"); + GROUPID_SET.add("io.etcd"); + GROUPID_SET.add("org.apache.flink"); + GROUPID_SET.add("org.apache.rocketmq"); + GROUPID_SET.add("org.apache.kafka"); + GROUPID_SET.add("org.apache.hudi"); + GROUPID_SET.add("com.rabbitmq"); + GROUPID_SET.add("org.apache.dubbo"); + GROUPID_SET.add("cn.hutool"); + GROUPID_SET.add("com.alibaba.nacos"); + GROUPID_SET.add("com.alibaba.csp"); + GROUPID_SET.add("io.zipkin.zipkin2"); + GROUPID_SET.add("org.apache.skywalking"); + GROUPID_SET.add("com.ctrip.framework.apollo"); + GROUPID_SET.add("org.apache.shardingsphere"); + GROUPID_SET.add("ru.yandex.clickhouse"); + GROUPID_SET.add("com.clickhouse"); + GROUPID_SET.add("org.apache.activemq"); + GROUPID_SET.add("org.bytedeco"); + GROUPID_SET.add("ws.schild"); + GROUPID_SET.add("io.netty"); + GROUPID_SET.add("io.micrometer"); + GROUPID_SET.add("org.apache.pulsar"); + } + private FilterChain filterChain; + @Override + public void setNext(FilterChain nextInChain) { + this.filterChain = nextInChain; + } + + @Override + public boolean ignoreArtifactById(CustomArtifact artifact) { + String groupId = artifact.getGroupId(); + if (GROUPID_SET.stream().anyMatch(groupId::contains)) { + return true; + } + return this.ignore(filterChain, artifact); + } +} diff --git a/src/main/java/com/smartdoc/gradle/chain/SpringBootArtifactFilterChain.java b/src/main/java/com/smartdoc/gradle/chain/SpringBootArtifactFilterChain.java index 9069d3f..b0395c3 100644 --- a/src/main/java/com/smartdoc/gradle/chain/SpringBootArtifactFilterChain.java +++ b/src/main/java/com/smartdoc/gradle/chain/SpringBootArtifactFilterChain.java @@ -1,5 +1,5 @@ /* - * smart-doc https://github.com/shalousun/smart-doc + * smart-doc https://github.com/smart-doc-group/smart-doc * * Copyright (C) 2018-2023 smart-doc * diff --git a/src/main/java/com/smartdoc/gradle/chain/StartsWithFilterChain.java b/src/main/java/com/smartdoc/gradle/chain/StartsWithFilterChain.java index d05ad24..008d360 100644 --- a/src/main/java/com/smartdoc/gradle/chain/StartsWithFilterChain.java +++ b/src/main/java/com/smartdoc/gradle/chain/StartsWithFilterChain.java @@ -1,5 +1,5 @@ /* - * smart-doc https://github.com/shalousun/smart-doc + * smart-doc https://github.com/smart-doc-group/smart-doc * * Copyright (C) 2018-2023 smart-doc * @@ -34,8 +34,6 @@ public class StartsWithFilterChain implements FilterChain { private final static Set PREFIX_SET = new HashSet<>(); - private FilterChain filterChain; - static { PREFIX_SET.add("maven"); PREFIX_SET.add("asm"); @@ -70,8 +68,16 @@ public class StartsWithFilterChain implements FilterChain { PREFIX_SET.add("springfox"); PREFIX_SET.add("elasticsearch"); PREFIX_SET.add("guava"); + PREFIX_SET.add("fastjson"); + PREFIX_SET.add("bcprov"); + PREFIX_SET.add("aws-java-sdk"); + PREFIX_SET.add("hadoop"); + PREFIX_SET.add("xml"); + PREFIX_SET.add("sundr-codegen"); } + private FilterChain filterChain; + @Override public void setNext(FilterChain nextInChain) { this.filterChain = nextInChain; diff --git a/src/main/java/com/smartdoc/gradle/model/CustomArtifact.java b/src/main/java/com/smartdoc/gradle/model/CustomArtifact.java index 8381b27..51a731f 100644 --- a/src/main/java/com/smartdoc/gradle/model/CustomArtifact.java +++ b/src/main/java/com/smartdoc/gradle/model/CustomArtifact.java @@ -37,7 +37,7 @@ public class CustomArtifact { /** * Artifact Group */ - private String group; + private String groupId; /** * Artifact Version @@ -80,12 +80,12 @@ public CustomArtifact setArtifactId(String artifactId) { return this; } - public String getGroup() { - return group; + public String getGroupId() { + return groupId; } public CustomArtifact setGroup(String group) { - this.group = group; + this.groupId = group; return this; } diff --git a/src/main/java/com/smartdoc/gradle/util/ArtifactFilterUtil.java b/src/main/java/com/smartdoc/gradle/util/ArtifactFilterUtil.java index 2e83984..d1c7ab0 100644 --- a/src/main/java/com/smartdoc/gradle/util/ArtifactFilterUtil.java +++ b/src/main/java/com/smartdoc/gradle/util/ArtifactFilterUtil.java @@ -25,9 +25,6 @@ import com.smartdoc.gradle.chain.*; import com.smartdoc.gradle.model.CustomArtifact; -import java.util.Set; -import java.util.regex.Pattern; - /** * Artifact filter util @@ -43,12 +40,17 @@ public class ArtifactFilterUtil { * @return boolean */ public static boolean ignoreArtifact(CustomArtifact artifact) { + FilterChain groupFilterChain = new GroupIdFilterChain(); FilterChain startsWithFilterChain = new StartsWithFilterChain(); FilterChain containsFilterChain = new ContainsFilterChain(); FilterChain commonArtifactFilterChain = new CommonArtifactFilterChain(); + FilterChain springBootArtifactFilterChain = new SpringBootArtifactFilterChain(); + + groupFilterChain.setNext(startsWithFilterChain); startsWithFilterChain.setNext(containsFilterChain); containsFilterChain.setNext(commonArtifactFilterChain); - return startsWithFilterChain.ignoreArtifactById(artifact); + commonArtifactFilterChain.setNext(springBootArtifactFilterChain); + return groupFilterChain.ignoreArtifactById(artifact); } /**