Skip to content
This repository was archived by the owner on Feb 24, 2026. It is now read-only.

Commit 6e57c47

Browse files
committed
HugeGraph-1312: Add config to deploy to sonatype maven respority
Change-Id: I981ecc2486b8091b6c1b039d79da9c05ee3aaa14
1 parent f72cf78 commit 6e57c47

File tree

7 files changed

+122
-52
lines changed

7 files changed

+122
-52
lines changed

pom.xml

Lines changed: 85 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,54 @@
66

77
<groupId>com.baidu.hugegraph</groupId>
88
<artifactId>hugegraph-common</artifactId>
9-
<version>1.4.6-SNAPSHOT</version>
9+
<version>1.4.6</version>
1010

11-
<distributionManagement>
12-
<snapshotRepository>
13-
<id>Baidu_Local_Snapshots</id>
14-
<url>http://maven.scm.baidu.com:8081/nexus/content/repositories/Baidu_Local_Snapshots</url>
15-
</snapshotRepository>
16-
</distributionManagement>
11+
<name>hugegraph-common</name>
12+
<url>https://github.com/hugegraph/hugegraph-common</url>
13+
<description>
14+
hugegraph-common is a tool module for HugeGraph and its peripheral components.
15+
hugegraph-common encapsulates locks, configurations, events, iterators, rest and some
16+
numeric or collection util classes to simplify the development of HugeGraph and its components.
17+
</description>
18+
19+
<parent>
20+
<groupId>org.sonatype.oss</groupId>
21+
<artifactId>oss-parent</artifactId>
22+
<version>7</version>
23+
</parent>
24+
25+
<licenses>
26+
<license>
27+
<name>The Apache Software License, Version 2.0</name>
28+
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
29+
<distribution>repo</distribution>
30+
</license>
31+
</licenses>
32+
33+
<scm>
34+
<url>https://github.com/hugegraph/hugegraph-common</url>
35+
<connection>https://github.com/hugegraph/hugegraph-common</connection>
36+
<developerConnection>https://github.com/hugegraph/hugegraph-common</developerConnection>
37+
</scm>
38+
39+
<developers>
40+
<developer>
41+
<name>lizhangmei</name>
42+
<email>lizhangmei@baidu.com</email>
43+
</developer>
44+
<developer>
45+
<name>zhoney</name>
46+
<email>zhangyi89817@126.com</email>
47+
</developer>
48+
<developer>
49+
<name>liningrui</name>
50+
<email>liningrui@vip.qq.com</email>
51+
</developer>
52+
</developers>
1753

1854
<properties>
1955
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
2056
<top.level.dir>${project.basedir}/..</top.level.dir>
21-
<final.name>hugegraph-bin</final.name>
2257
<compiler.source>1.8</compiler.source>
2358
<compiler.target>1.8</compiler.target>
2459
<log4j2.version>2.8.2</log4j2.version>
@@ -81,14 +116,13 @@
81116
<dependency>
82117
<groupId>commons-configuration</groupId>
83118
<artifactId>commons-configuration</artifactId>
84-
<version>1.10</version>
119+
<version>${commons.configuration.version}</version>
85120
</dependency>
86121
<dependency>
87122
<groupId>org.apache.commons</groupId>
88123
<artifactId>commons-configuration2</artifactId>
89124
<version>${commons.configuration2.version}</version>
90125
</dependency>
91-
92126
<dependency>
93127
<groupId>commons-io</groupId>
94128
<artifactId>commons-io</artifactId>
@@ -133,7 +167,6 @@
133167
<artifactId>jersey-media-json-jackson</artifactId>
134168
<version>${jersey.version}</version>
135169
</dependency>
136-
137170
</dependencies>
138171

139172
<build>
@@ -153,25 +186,6 @@
153186
</configuration>
154187
</plugin>
155188

156-
<plugin>
157-
<artifactId>maven-clean-plugin</artifactId>
158-
<version>3.0.0</version>
159-
<configuration>
160-
<filesets>
161-
<fileset>
162-
<directory>${top.level.dir}</directory>
163-
<includes>
164-
<include>*.tar.gz</include>
165-
</includes>
166-
<followSymlinks>false</followSymlinks>
167-
</fileset>
168-
<fileset>
169-
<directory>${final.name}</directory>
170-
</fileset>
171-
</filesets>
172-
</configuration>
173-
</plugin>
174-
175189
<plugin>
176190
<groupId>org.apache.maven.plugins</groupId>
177191
<artifactId>maven-jar-plugin</artifactId>
@@ -195,7 +209,47 @@
195209
</archive>
196210
</configuration>
197211
</plugin>
212+
213+
<plugin>
214+
<groupId>org.apache.maven.plugins</groupId>
215+
<artifactId>maven-source-plugin</artifactId>
216+
<version>2.2.1</version>
217+
<executions>
218+
<execution>
219+
<id>attach-sources</id>
220+
<goals>
221+
<goal>jar-no-fork</goal>
222+
</goals>
223+
</execution>
224+
</executions>
225+
</plugin>
226+
<plugin>
227+
<groupId>org.apache.maven.plugins</groupId>
228+
<artifactId>maven-javadoc-plugin</artifactId>
229+
<version>2.9.1</version>
230+
<executions>
231+
<execution>
232+
<id>attach-javadocs</id>
233+
<goals>
234+
<goal>jar</goal>
235+
</goals>
236+
</execution>
237+
</executions>
238+
</plugin>
239+
<plugin>
240+
<groupId>org.apache.maven.plugins</groupId>
241+
<artifactId>maven-gpg-plugin</artifactId>
242+
<version>1.5</version>
243+
<executions>
244+
<execution>
245+
<id>sign-artifacts</id>
246+
<phase>verify</phase>
247+
<goals>
248+
<goal>sign</goal>
249+
</goals>
250+
</execution>
251+
</executions>
252+
</plugin>
198253
</plugins>
199254
</build>
200-
201255
</project>

src/main/java/com/baidu/hugegraph/concurrent/KeyLock.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ public final List<Lock> lockAll(Object... keys) {
9999
/**
100100
* Lock two objects with sorted order
101101
* NOTE: This is to optimize the performance of lockAll(keys)
102+
* @param key1 The first object
103+
* @param key2 The second object
104+
* @return locks for the two objects
102105
*/
103106
public List<Lock> lockAll(Object key1, Object key2) {
104107
Lock lock1 = this.locks.get(key1);

src/main/java/com/baidu/hugegraph/stats/MetricsManager.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -313,9 +313,9 @@ public synchronized void removeSlf4jReporter() {
313313
* provided arguments
314314
*/
315315
public synchronized void addGangliaReporter(
316-
String groupOrHost, int port, UDPAddressingMode addressingMode,
317-
int ttl, Boolean protocol31, UUID hostUUID, String spoof,
318-
Duration reportInterval) throws IOException {
316+
String groupOrHost, int port, UDPAddressingMode addressingMode,
317+
int ttl, Boolean protocol31, UUID hostUUID, String spoof,
318+
Duration reportInterval) throws IOException {
319319

320320
Preconditions.checkNotNull(groupOrHost);
321321
Preconditions.checkNotNull(addressingMode);
@@ -346,8 +346,7 @@ public synchronized void addGangliaReporter(
346346

347347
/**
348348
* Stop a {@link GangliaReporter} previously created by a call to
349-
* {@link #addGangliaReporter(String, int, UDPAddressingMode, int, Boolean,
350-
* UUID, String, Duration)}
349+
* {@link #addGangliaReporter}
351350
* and release it for GC. Idempotent between calls to the associated add
352351
* method. Does nothing before the first call to the associated add method.
353352
*/

src/main/java/com/baidu/hugegraph/util/CollectionUtil.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ public static boolean allUnique(Collection<?> collection){
7474
* @param original original set
7575
* @param from index of start position
7676
* @param to index of end position(exclude), but -1 means the last element
77-
* @return sub-set of original set [from,to)
77+
* @param <T> element type of set
78+
* @return sub-set of original set [from, to)
7879
*/
7980
public static <T> Set<T> subSet(Set<T> original, int from, int to) {
8081
List<T> list = new ArrayList<>(original);

src/main/java/com/baidu/hugegraph/util/LongEncoding.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@
2121

2222
/**
2323
* Utility class for encoding longs in strings based on:
24-
* {@linktourl http://stackoverflow.com/questions/2938482/encode-decode-a-long-to-a-string-using-a-fixed-set-of-letters-in-java}
25-
*
24+
* @see <a href="http://stackoverflow.com/questions/2938482/encode-decode-a-long-to-a-string-using-a-fixed-set-of-letters-in-java">encode decode long to string</a>
2625
*/
2726
public final class LongEncoding {
2827

src/main/java/com/baidu/hugegraph/util/NumericUtil.java

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ private NumericUtil() {
4141
* precision is not reduced, but the value can easily used as a long. The
4242
* sort order (including {@link Double#NaN}) is defined by
4343
* {@link Double#compareTo}; {@code NaN} is greater than positive infinity.
44-
*
44+
* @param val input double value
45+
* @return output sortable long value
4546
* @see #sortableLongToDouble
4647
*/
4748
public static long doubleToSortableLong(double val) {
@@ -50,7 +51,8 @@ public static long doubleToSortableLong(double val) {
5051

5152
/**
5253
* Converts a sortable <code>long</code> back to a <code>double</code>.
53-
*
54+
* @param val input double value
55+
* @return output sortable long value
5456
* @see #doubleToSortableLong
5557
*/
5658
public static double sortableLongToDouble(long val) {
@@ -65,7 +67,8 @@ public static double sortableLongToDouble(long val) {
6567
* is not reduced, but the value can easily used as an int. The sort order
6668
* (including {@link Float#NaN}) is defined by {@link Float#compareTo};
6769
* {@code NaN} is greater than positive infinity.
68-
*
70+
* @param val input float value
71+
* @return output sortable int value
6972
* @see #sortableIntToFloat
7073
*/
7174
public static int floatToSortableInt(float val) {
@@ -74,7 +77,8 @@ public static int floatToSortableInt(float val) {
7477

7578
/**
7679
* Converts a sortable <code>int</code> back to a <code>float</code>.
77-
*
80+
* @param val input int value
81+
* @return output sortable float value
7882
* @see #floatToSortableInt
7983
*/
8084
public static float sortableIntToFloat(int val) {
@@ -84,6 +88,8 @@ public static float sortableIntToFloat(int val) {
8488
/**
8589
* Converts IEEE 754 representation of a double to sortable order (or back
8690
* to the original)
91+
* @param bits The long format of a double value
92+
* @return The sortable long value
8793
*/
8894
public static long sortableDoubleBits(long bits) {
8995
return bits ^ (bits >> 63) & 0x7fffffffffffffffL;
@@ -92,13 +98,13 @@ public static long sortableDoubleBits(long bits) {
9298
/**
9399
* Converts IEEE 754 representation of a float to sortable order (or back to
94100
* the original)
101+
* @param bits The int format of an float value
102+
* @return The sortable int value
95103
*/
96104
public static int sortableFloatBits(int bits) {
97105
return bits ^ (bits >> 31) & 0x7fffffff;
98106
}
99107

100-
/*************************************************************************/
101-
102108
public static byte[] numberToSortableBytes(Number number) {
103109
if (number instanceof Long) {
104110
return longToBytes(number.longValue());
@@ -137,8 +143,6 @@ public static Number sortableBytesToNumber(byte[] bytes, Class<?> clazz) {
137143
return null;
138144
}
139145

140-
/*************************************************************************/
141-
142146
public static byte[] longToBytes(long value) {
143147
ByteBuffer buffer = ByteBuffer.allocate(Long.BYTES);
144148
buffer.putLong(value);
@@ -161,8 +165,6 @@ public static int bytesToInt(byte[] bytes) {
161165
return ByteBuffer.wrap(bytes).getInt();
162166
}
163167

164-
/*************************************************************************/
165-
166168
public static boolean isNumber(Object value) {
167169
if (value == null) {
168170
return false;
@@ -174,8 +176,6 @@ public static boolean isNumber(Class<?> clazz) {
174176
return Number.class.isAssignableFrom(clazz);
175177
}
176178

177-
/*************************************************************************/
178-
179179
public static Object convertToNumber(Object value) {
180180
if (!isNumber(value) && value != null) {
181181
if (value instanceof Date) {
@@ -193,6 +193,10 @@ public static Object convertToNumber(Object value) {
193193
* or it can be converted to a BigDecimal
194194
* @param first might be number or string
195195
* @param second must be number
196+
* @return the value 0 if first is numerically equal to second;
197+
* a value less than 0 if first is numerically less than
198+
* second; and a value greater than 0 if first is
199+
* numerically greater than second.
196200
*/
197201
@SuppressWarnings("unchecked")
198202
public static int compareNumber(Object first, Number second) {

src/main/java/com/baidu/hugegraph/util/VersionUtil.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@
2727
public final class VersionUtil {
2828

2929
/**
30-
* Compare if a version is inside a range: begin <= version < end
30+
* Compare if a version is inside a range [begin, end)
31+
* @param version The version to be compared
32+
* @param begin The lower bound of the range
33+
* @param end The upper bound of the range
34+
* @return true if belong to the range, otherwise false
3135
*/
3236
public static boolean match(Version version, String begin, String end) {
3337
E.checkArgumentNotNull(version, "The version to match is null");
@@ -38,6 +42,10 @@ public static boolean match(Version version, String begin, String end) {
3842
/**
3943
* Check whether a component version is matched expected range,
4044
* throw an exception if it's not matched.
45+
* @param version The version to be checked
46+
* @param begin The lower bound of the range
47+
* @param end The upper bound of the range
48+
* @param component The owner component of version
4149
*/
4250
public static void check(Version version, String begin, String end,
4351
String component) {
@@ -48,6 +56,8 @@ public static void check(Version version, String begin, String end,
4856

4957
/**
5058
* Get implementation version from manifest in jar
59+
* @param clazz The class to be load from jar package
60+
* @return The implementation version
5161
*/
5262
public static String getImplementationVersion(Class<?> clazz) {
5363
/*

0 commit comments

Comments
 (0)