├── .gitignore ├── src └── main │ └── java │ └── com │ └── github │ └── ksprider │ └── surgical │ ├── TreeHandler.java │ ├── SerializationHandler.java │ ├── spring │ └── mvc │ │ ├── config │ │ ├── JSONConfiguration.java │ │ └── EnableJSON.java │ │ ├── JSON.java │ │ ├── ObjectMapperConfig.java │ │ └── JSONResponseBodyAdvice.java │ ├── CustomFilterProvider.java │ ├── node │ ├── Node.java │ ├── NodeSerializerHandler.java │ └── NodeTreeHandler.java │ └── CustomPropertyFilter.java ├── LICENSE ├── README.md └── pom.xml /.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | 3 | .classpath 4 | .factorypath 5 | .project 6 | .settings 7 | .springBeans 8 | 9 | .idea 10 | *.iws 11 | *.iml 12 | *.ipr -------------------------------------------------------------------------------- /src/main/java/com/github/ksprider/surgical/TreeHandler.java: -------------------------------------------------------------------------------- 1 | package com.github.ksprider.surgical; 2 | 3 | public interface TreeHandler { 4 | 5 | T treefy(String treeStr); 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/com/github/ksprider/surgical/SerializationHandler.java: -------------------------------------------------------------------------------- 1 | package com.github.ksprider.surgical; 2 | 3 | import com.fasterxml.jackson.core.JsonStreamContext; 4 | 5 | public interface SerializationHandler { 6 | 7 | boolean isSerialize(JsonStreamContext context, String currentPropertyName, T t); 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/com/github/ksprider/surgical/spring/mvc/config/JSONConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.github.ksprider.surgical.spring.mvc.config; 2 | 3 | import org.springframework.context.annotation.ComponentScan; 4 | import org.springframework.context.annotation.Configuration; 5 | 6 | @Configuration 7 | @ComponentScan("com.github.ksprider.surgical") 8 | public class JSONConfiguration { 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/github/ksprider/surgical/spring/mvc/JSON.java: -------------------------------------------------------------------------------- 1 | package com.github.ksprider.surgical.spring.mvc; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | @Retention(RetentionPolicy.RUNTIME) 9 | @Target(ElementType.METHOD) 10 | public @interface JSON { 11 | 12 | String value(); 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/github/ksprider/surgical/spring/mvc/config/EnableJSON.java: -------------------------------------------------------------------------------- 1 | package com.github.ksprider.surgical.spring.mvc.config; 2 | 3 | import org.springframework.context.annotation.Import; 4 | 5 | import java.lang.annotation.ElementType; 6 | import java.lang.annotation.Retention; 7 | import java.lang.annotation.RetentionPolicy; 8 | import java.lang.annotation.Target; 9 | 10 | @Retention(RetentionPolicy.RUNTIME) 11 | @Target(ElementType.TYPE) 12 | @Import(JSONConfiguration.class) 13 | public @interface EnableJSON { 14 | } 15 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 King 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/main/java/com/github/ksprider/surgical/CustomFilterProvider.java: -------------------------------------------------------------------------------- 1 | package com.github.ksprider.surgical; 2 | 3 | import com.fasterxml.jackson.databind.ser.BeanPropertyFilter; 4 | import com.fasterxml.jackson.databind.ser.FilterProvider; 5 | import com.fasterxml.jackson.databind.ser.PropertyFilter; 6 | 7 | public class CustomFilterProvider extends FilterProvider { 8 | 9 | private final CustomPropertyFilter customPropertyFilter; 10 | 11 | public CustomFilterProvider() { 12 | this.customPropertyFilter = new CustomPropertyFilter<>(null, null, null, true); 13 | } 14 | 15 | public CustomFilterProvider(T root, SerializationHandler serializerHandler, String location, boolean isAll) { 16 | this.customPropertyFilter = new CustomPropertyFilter<>(root, serializerHandler, location, isAll); 17 | } 18 | 19 | @SuppressWarnings("deprecation") 20 | @Override 21 | public BeanPropertyFilter findFilter(Object filterId) { 22 | return customPropertyFilter; 23 | } 24 | 25 | @Override 26 | public PropertyFilter findPropertyFilter(Object filterId, Object valueToFilter) { 27 | return customPropertyFilter; 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/github/ksprider/surgical/node/Node.java: -------------------------------------------------------------------------------- 1 | package com.github.ksprider.surgical.node; 2 | 3 | import java.util.HashMap; 4 | import java.util.HashSet; 5 | import java.util.Map; 6 | import java.util.Set; 7 | 8 | public class Node implements Cloneable { 9 | 10 | 11 | private String name; 12 | 13 | private Set propertySet = new HashSet<>(); 14 | 15 | private Map nodes = new HashMap<>(); 16 | 17 | 18 | public Node() { 19 | 20 | } 21 | 22 | public Node(String name) { 23 | this.name = name; 24 | } 25 | 26 | public String getName() { 27 | return name; 28 | } 29 | 30 | public void setName(String name) { 31 | this.name = name; 32 | } 33 | 34 | public Set getPropertySet() { 35 | return propertySet; 36 | } 37 | 38 | public void setPropertySet(Set propertySet) { 39 | this.propertySet = propertySet; 40 | } 41 | 42 | public Map getNodes() { 43 | return nodes; 44 | } 45 | 46 | public void setNodes(Map nodes) { 47 | this.nodes = nodes; 48 | } 49 | 50 | @Override 51 | public Node clone() throws CloneNotSupportedException { 52 | return (Node)super.clone(); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/com/github/ksprider/surgical/spring/mvc/ObjectMapperConfig.java: -------------------------------------------------------------------------------- 1 | package com.github.ksprider.surgical.spring.mvc; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFilter; 4 | import com.fasterxml.jackson.databind.ObjectMapper; 5 | import com.github.ksprider.surgical.CustomFilterProvider; 6 | import org.springframework.beans.factory.InitializingBean; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.context.annotation.Bean; 9 | import org.springframework.context.annotation.Configuration; 10 | 11 | import java.io.Serializable; 12 | 13 | @Configuration 14 | public class ObjectMapperConfig implements InitializingBean { 15 | 16 | private ObjectMapper objectMapper; 17 | 18 | @Autowired 19 | public void setObjectMapper(ObjectMapper objectMapper) { 20 | this.objectMapper = objectMapper; 21 | } 22 | 23 | @Bean 24 | public CustomFilterProvider defaultFilterProvider() { 25 | return new CustomFilterProvider<>(); 26 | } 27 | 28 | @Override 29 | public void afterPropertiesSet() throws Exception { 30 | objectMapper.addMixIn(Serializable.class, CustomPropertyFilterMixIn.class); 31 | objectMapper.setFilterProvider(defaultFilterProvider()); 32 | } 33 | 34 | @JsonFilter("customPropertyFilter") 35 | class CustomPropertyFilterMixIn {} 36 | } 37 | 38 | -------------------------------------------------------------------------------- /src/main/java/com/github/ksprider/surgical/node/NodeSerializerHandler.java: -------------------------------------------------------------------------------- 1 | package com.github.ksprider.surgical.node; 2 | 3 | import com.fasterxml.jackson.core.JsonStreamContext; 4 | import com.github.ksprider.surgical.SerializationHandler; 5 | import org.springframework.stereotype.Service; 6 | 7 | import java.util.Objects; 8 | import java.util.Stack; 9 | import java.util.concurrent.atomic.AtomicBoolean; 10 | 11 | @Service 12 | public class NodeSerializerHandler implements SerializationHandler { 13 | 14 | private static final String ALL = "*"; 15 | 16 | @Override 17 | public boolean isSerialize(JsonStreamContext context, String currentPropertyName, Node node) { 18 | AtomicBoolean serialize = new AtomicBoolean(false); 19 | Stack stack = new Stack<>(); 20 | String propertyName = currentPropertyName; 21 | 22 | while (!Objects.isNull(context.getParent())) { 23 | if (null != propertyName) { 24 | stack.push(propertyName); 25 | } 26 | context = context.getParent(); 27 | propertyName = context.getCurrentName(); 28 | } 29 | 30 | if (!stack.isEmpty()) { 31 | for (Node n = node.getNodes().get(stack.peek()); Objects.nonNull(node) && !stack.isEmpty() && (node.getPropertySet().contains(stack.peek()) || Objects.nonNull(n) || node.getPropertySet().contains(ALL));) { 32 | stack.pop(); 33 | node = n; 34 | if (null != node && !stack.isEmpty()) { 35 | n = node.getNodes().get(stack.peek()); 36 | } 37 | } 38 | if (stack.isEmpty()) { 39 | serialize.set(true); 40 | } 41 | } 42 | return serialize.get(); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/github/ksprider/surgical/CustomPropertyFilter.java: -------------------------------------------------------------------------------- 1 | package com.github.ksprider.surgical; 2 | 3 | import com.fasterxml.jackson.core.JsonGenerator; 4 | import com.fasterxml.jackson.core.JsonStreamContext; 5 | import com.fasterxml.jackson.databind.SerializerProvider; 6 | import com.fasterxml.jackson.databind.ser.PropertyWriter; 7 | import com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter; 8 | import org.springframework.beans.BeanUtils; 9 | import org.springframework.http.converter.json.MappingJacksonValue; 10 | 11 | import java.util.HashMap; 12 | import java.util.Map; 13 | import java.util.Objects; 14 | 15 | public class CustomPropertyFilter extends SimpleBeanPropertyFilter { 16 | 17 | private final T t; 18 | private final SerializationHandler serializerHandler; 19 | private final String location; 20 | private final boolean isAll; 21 | private final Map cache = new HashMap<>(); 22 | 23 | public CustomPropertyFilter(T t, SerializationHandler serializerHandler, String location, boolean isAll) { 24 | this.t = t; 25 | this.serializerHandler = serializerHandler; 26 | this.location = location; 27 | this.isAll = isAll; 28 | } 29 | 30 | @SuppressWarnings("unchecked") 31 | @Override 32 | public void serializeAsField(Object pojo, JsonGenerator gen, SerializerProvider prov, PropertyWriter writer) throws Exception { 33 | if (pojo instanceof MappingJacksonValue) { 34 | writer.serializeAsField(pojo, gen, prov); 35 | return; 36 | } 37 | boolean serialize = isAll || cache.computeIfAbsent(getKey(gen.getOutputContext(), writer.getName()), it -> { 38 | T ot = (T) BeanUtils.instantiateClass(t.getClass()); 39 | BeanUtils.copyProperties(t, ot); 40 | return serializerHandler.isSerialize(gen.getOutputContext(), writer.getName(), ot); 41 | }); 42 | if (serialize) { 43 | writer.serializeAsField(pojo, gen, prov); 44 | } 45 | } 46 | 47 | private String getKey(JsonStreamContext context, String name) { 48 | StringBuilder sb = new StringBuilder(location); 49 | for (JsonStreamContext c = context.getParent(); Objects.nonNull(c); c = c.getParent()) { 50 | sb.append("#"); 51 | sb.append(Objects.isNull(c.getCurrentName()) ? name : c.getCurrentName()); 52 | } 53 | return sb.toString(); 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/com/github/ksprider/surgical/node/NodeTreeHandler.java: -------------------------------------------------------------------------------- 1 | package com.github.ksprider.surgical.node; 2 | 3 | import com.github.ksprider.surgical.TreeHandler; 4 | import org.springframework.stereotype.Service; 5 | 6 | import java.util.Objects; 7 | 8 | @Service 9 | public class NodeTreeHandler implements TreeHandler { 10 | 11 | private final char COMMA = ','; 12 | private final char OPEN_PAREN = '('; 13 | private final char CLOSE_PAREN = ')'; 14 | 15 | @Override 16 | public Node treefy(String treeStr) { 17 | Node root = new Node("root"); 18 | doTreefy(treeStr, root); 19 | return root; 20 | } 21 | 22 | private int doTreefy(String treeStr, Node root) { 23 | int resultIndex = 0; 24 | 25 | for (int nextSymbolIndex = getNextSymbolIndex(treeStr); nextSymbolIndex >= 0; nextSymbolIndex = getNextSymbolIndex(treeStr)) { 26 | resultIndex += nextSymbolIndex + 1; 27 | 28 | char nextSymbol = treeStr.charAt(nextSymbolIndex); 29 | switch (nextSymbol) { 30 | case COMMA: { 31 | root.getPropertySet().add(treeStr.substring(0, nextSymbolIndex)); 32 | treeStr = treeStr.substring(nextSymbolIndex + 1); 33 | break; 34 | } 35 | case OPEN_PAREN: { 36 | Node node = new Node(treeStr.substring(0, nextSymbolIndex)); 37 | int subIndex = doTreefy(treeStr.substring(nextSymbolIndex + 1), node); 38 | root.getNodes().put(node.getName(), node); 39 | 40 | resultIndex += subIndex; 41 | treeStr = treeStr.substring(nextSymbolIndex + 1 + subIndex); 42 | break; 43 | } 44 | case CLOSE_PAREN: { 45 | root.getPropertySet().add(treeStr.substring(0, nextSymbolIndex)); 46 | return resultIndex; 47 | } 48 | default: { 49 | root.getPropertySet().add(treeStr); 50 | treeStr = ""; 51 | break; 52 | } 53 | } 54 | } 55 | return -1; 56 | } 57 | 58 | private int getNextSymbolIndex(String str) { 59 | if (Objects.isNull(str)) return Integer.MIN_VALUE; 60 | 61 | int min = str.length() - 1; 62 | 63 | if (str.indexOf(COMMA) >= 0) { 64 | min = Math.min(min, str.indexOf(COMMA)); 65 | } 66 | if (str.indexOf(OPEN_PAREN) >= 0) { 67 | min = Math.min(min, str.indexOf(OPEN_PAREN)); 68 | } 69 | if (str.indexOf(CLOSE_PAREN) >= 0) { 70 | min = Math.min(min, str.indexOf(CLOSE_PAREN)); 71 | } 72 | 73 | return min; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Surgical 2 | A tool for dynamically filtering entity properties based on Jackson. 3 | 4 | 5 | ## Usage 6 | 7 | 1. Add denpendency 8 | ```xml 9 | 10 | com.github.ksprider 11 | Surgical 12 | 0.0.5 13 | 14 | ``` 15 | 2. Enable Surgical with `@EnableJSON` 16 | ```java 17 | @SpringBootApplication 18 | @EnableJSON 19 | public class RestServiceApplication { 20 | public static void main(String[] args) { 21 | SpringApplication.run(RestServiceApplication.class, args); 22 | } 23 | } 24 | ``` 25 | 26 | 3. Add annotation to method 27 | ```java 28 | @JSON 29 | ``` 30 | 31 | 32 | ## Demo 33 | 34 | > Object which will to be filted must implement java.io.Serializable interface. 35 | 36 | ```java 37 | class Tiger implements Serializable { 38 | public int no; 39 | public String name; 40 | public int age; 41 | 42 | public Zoo zoo; 43 | } 44 | 45 | class Zoo implements Serializable { 46 | public String name; 47 | public String address; 48 | 49 | public City city; 50 | } 51 | 52 | class City implements Serializable { 53 | public int id; 54 | public String name; 55 | 56 | } 57 | ``` 58 | 59 | ### All properties 60 | ```java 61 | @GetMapping("/demo0") 62 | @JSON("no,name,age,zoo(name,address,city(id,name))") 63 | public Tiger demo0() { 64 | City city = new City(); 65 | city.id = 100001; 66 | city.name = "Singapore"; 67 | 68 | Zoo zoo = new Zoo(); 69 | zoo.name = "Singapore Zoo"; 70 | zoo.address = "80 Mandai Lake Rd, Singapore 729826"; 71 | zoo.city = city; 72 | 73 | Tiger tiger = new Tiger(); 74 | tiger.no = 1; 75 | tiger.name = "Pasha"; 76 | tiger.age = 4; 77 | tiger.zoo = zoo; 78 | return tiger; 79 | } 80 | ``` 81 | 82 | `[{"no":1,"name":"Pasha","age":4,"zoo":{"name":"Singapore Zoo","address":"80 Mandai Lake Rd, Singapore 729826","city":{"id":100001,"name":"Singapore"}}}]` 83 | 84 | ### Some properties 85 | 86 | #### demo1 87 | ```java 88 | @GetMapping("/demo1") 89 | @JSON("no,name,zoo(name,city(name))") 90 | public Tiger demo1() { 91 | // same with above 92 | return tiger; 93 | } 94 | ``` 95 | ```json 96 | {"no":1,"name":"Pasha","zoo":{"name":"Singapore Zoo","city":{"name":"Singapore"}}} 97 | ``` 98 | 99 | 100 | #### demo2 101 | ```java 102 | @GetMapping("/demo2") 103 | @JSON("no,name") 104 | public Tiger demo2() { 105 | // same with above 106 | return tiger; 107 | } 108 | ``` 109 | ```json 110 | {"no":1,"name":"Pasha"} 111 | ``` 112 | 113 | #### demo3 114 | ```java 115 | @GetMapping("/demo3") 116 | @JSON("no,name,zoo(name,city(*))") 117 | public Tiger demo3() { 118 | // same with above 119 | return tiger; 120 | } 121 | ``` 122 | ```json 123 | {"no":1,"name":"Pasha","zoo":{"name":"Singapore Zoo","city":{"id":100001,"name":"Singapore"}}} 124 | ``` 125 | -------------------------------------------------------------------------------- /src/main/java/com/github/ksprider/surgical/spring/mvc/JSONResponseBodyAdvice.java: -------------------------------------------------------------------------------- 1 | package com.github.ksprider.surgical.spring.mvc; 2 | 3 | import com.github.ksprider.surgical.CustomFilterProvider; 4 | import com.github.ksprider.surgical.SerializationHandler; 5 | import com.github.ksprider.surgical.TreeHandler; 6 | import com.github.ksprider.surgical.node.Node; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.core.MethodParameter; 9 | import org.springframework.core.annotation.AnnotatedElementUtils; 10 | import org.springframework.http.MediaType; 11 | import org.springframework.http.converter.HttpMessageConverter; 12 | import org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter; 13 | import org.springframework.http.converter.json.MappingJacksonValue; 14 | import org.springframework.http.server.ServerHttpRequest; 15 | import org.springframework.http.server.ServerHttpResponse; 16 | import org.springframework.web.bind.annotation.ControllerAdvice; 17 | import org.springframework.web.bind.annotation.ResponseBody; 18 | import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice; 19 | 20 | import java.util.HashMap; 21 | import java.util.Map; 22 | import java.util.Optional; 23 | 24 | @ControllerAdvice 25 | public class JSONResponseBodyAdvice implements ResponseBodyAdvice { 26 | 27 | private TreeHandler treeHandler; 28 | private SerializationHandler serializationHandler; 29 | private final Map cache = new HashMap<>(); 30 | 31 | @Autowired 32 | public void setTreeHandler(TreeHandler treeHandler) { 33 | this.treeHandler = treeHandler; 34 | } 35 | 36 | @Autowired 37 | public void setSerializationHandler(SerializationHandler serializationHandler) { 38 | this.serializationHandler = serializationHandler; 39 | } 40 | 41 | @Override 42 | public boolean supports(MethodParameter methodParameter, Class> converterType) { 43 | return AbstractJackson2HttpMessageConverter.class.isAssignableFrom(converterType) && 44 | ( 45 | methodParameter.hasMethodAnnotation(JSON.class) 46 | || AnnotatedElementUtils.hasAnnotation(methodParameter.getContainingClass(), ResponseBody.class) 47 | || methodParameter.hasMethodAnnotation(ResponseBody.class) 48 | ); 49 | } 50 | 51 | @Override 52 | public Object beforeBodyWrite(Object o, MethodParameter methodParameter, MediaType mediaType, Class> selectedConverterType, ServerHttpRequest serverHttpRequest, ServerHttpResponse serverHttpResponse) { 53 | JSON jsonAnnotation = methodParameter.getMethod().getAnnotation(JSON.class); 54 | String key = methodParameter.getMethod().toString(); 55 | CustomFilterProvider customFilterProvider = cache.computeIfAbsent(key, (it) -> { 56 | boolean isAll = null == jsonAnnotation; 57 | String treeStr = isAll ? "*" : jsonAnnotation.value(); 58 | Node root = treeHandler.treefy(treeStr); 59 | return new CustomFilterProvider(root, serializationHandler, key, isAll); 60 | }); 61 | MappingJacksonValue value = new MappingJacksonValue(o); 62 | value.setFilters(customFilterProvider); 63 | return value; 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.github.ksprider 8 | Surgical 9 | jar 10 | Surgical 11 | 0.0.5 12 | A tool for dynamically filtering entity properties based on Jackson 13 | https://github.com/ksprider/Surgical 14 | 15 | 16 | 17 | King 18 | King@kspider.xyz 19 | https://github.com/ksprider 20 | 21 | 22 | 23 | 24 | 25 | MIT License 26 | http://www.opensource.org/licenses/mit-license.php 27 | repo 28 | 29 | 30 | 31 | 32 | https://github.com/ksprider/Surgical 33 | 34 | 35 | 36 | UTF-8 37 | 8 38 | 8 39 | 40 | 41 | 42 | 43 | org.springframework 44 | spring-web 45 | 5.3.4 46 | provided 47 | 48 | 49 | org.springframework 50 | spring-webmvc 51 | 5.3.4 52 | provided 53 | 54 | 55 | com.fasterxml.jackson.core 56 | jackson-databind 57 | 2.11.4 58 | provided 59 | 60 | 61 | 62 | 63 | 64 | oss 65 | https://s01.oss.sonatype.org/content/repositories/snapshots/ 66 | 67 | 68 | oss 69 | https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/ 70 | 71 | 72 | 73 | 74 | ${project.artifactId}-${project.version} 75 | 76 | 77 | org.apache.maven.plugins 78 | maven-compiler-plugin 79 | 3.8.1 80 | 81 | 8 82 | 8 83 | 84 | 85 | 86 | org.apache.maven.plugins 87 | maven-source-plugin 88 | 3.2.0 89 | 90 | 91 | attach-sources 92 | 93 | jar-no-fork 94 | 95 | 96 | 97 | 98 | 99 | org.apache.maven.plugins 100 | maven-javadoc-plugin 101 | 3.2.0 102 | 103 | 104 | attach-javadocs 105 | 106 | jar 107 | 108 | 109 | 110 | 111 | 112 | org.apache.maven.plugins 113 | maven-gpg-plugin 114 | 1.6 115 | 116 | 117 | sign-artifacts 118 | verify 119 | 120 | sign 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | --------------------------------------------------------------------------------