Category: Java

发布java library到Maven Central仓库

Publishing a Java Library to Maven Central 网络上有很多文章有介绍如何发布,很多都说得很详细,这里大概记录一下一些相关信息。 相关网址: 发布申请:sonatype官网 需要注册,并创建issue填写要发布项目的相关信息 官方文档,如何发布: Deploying to OSSRH with Apache Maven – Introduction gpg密钥相关: The GNU Privacy Guard官网 可以下载相关软件用于生成和管理gpg密钥,我使用的版本是 gpg (GnuPG) 2.3.7, libgcrypt 1.10.1,需要注意的是不同版本一些命令可能会有不同 发布时会先发布到repo1仓库,如果发布成功的话,正常30分钟左右就在上面看到,然后大概要4个小时才会同步到Maven Central 项目配置的仓库url 现在是s01开头这个,如果你的issue已经验证了groupId,并且指派者已经处理好的话,可以使用之前在官网注册的用户和密码登录这个仓库。 发布备忘 创建要发布的项目,以及配置好pom pom需要包含的信息: 项目url : <url><></url> 我这里项目仓库在github网站。 开发者信息 <developers> 许可证信息 <licenses> 发布管理 <distributionManagement> 配置要发布到的仓库的信息 scm信息(software configuration management)<scm> 【build】发布到maven central仓库,需要 nexus-staging-maven-plugin […]

关于 @SuppressWarnings

Java compilers are increasingly capable of issuing helpful “lint-like” warnings. To encourage the use of such warnings, there should be some way to disable a warning in a part of the program when the programmer knows that the warning is inappropriate. The annotation type SuppressWarnings supports programmer control over warnings otherwise issued by a Java compiler. It […]

Guidelines for Wildcard Use

转自jdk8文档 One of the more confusing aspects when learning to program with generics is determining when to use an upper bounded wildcard and when to use a lower bounded wildcard. This page provides some guidelines to follow when designing your code. For purposes of this discussion, it is helpful to think of variables as providing […]

volatile 以及同步相关内容

volatile Fields The Java programming language allows threads to access shared variables (§17.1). As a rule, to ensure that shared variables are consistently and reliably updated, a thread should ensure that it has exclusive use of such variables by obtaining a lock that, conventionally, enforces mutual exclusion for those shared variables. The Java programming language provides […]


Java 11 与 Java 8 的区别 日期 Java 11 多了 LocalDate.EPOCH 常量的定义, Java 8没有这个变量 Java中标签的使用 An unlabeled break statement terminates the innermost switch, for, while, or do-while statement, but a labeled break terminates an outer statement.  Java中标签主要是用来中断或者跳转到指定循环(非中断/跳转语句直接所在的循环),以下是随手写的示例代码,仅为展示标签使用: 如果随机生成的l值是10的倍数,则中断do-while循环;如果l值对10取模余数是2,则跳转到第二个for循环。 Maven 3.3.1+ requires JDK 1.7+. Maven 3.3.1+ requires JDK 1.7+. Please set appropriate JDK at Settings | Build, Execution, Deployment | Build Tools | Maven | […]

简单Java Applet示例

下午看到一个涉及到Java Applet的问题,发现自己已经都不知道多少年没接触Applet了,稍微看一下,运行了个简单示例。 JDK8 – Java Applets A Java applet is a special kind of Java program that a browser enabled with Java technology can download from the internet and run. An applet is typically embedded inside a web page and runs in the context of a browser. An applet must be a subclass of the java.applet.Applet class. […]

Java Queues

Queue A collection designed for holding elements prior to processing. Besides basic Collection operations, queues provide additional insertion, extraction, and inspection operations. Each of these methods exists in two forms: one throws an exception if the operation fails, the other returns a special value (either null or false, depending on the operation). The latter form of the insert operation is […]

Java 17 available now

Java 17 LTS is the latest long-term support release for the Java SE platform. JDK 17 binaries are free to use in production and free to redistribute, at no cost, under the Oracle No-Fee Terms and Conditions. JDK 17 will receive updates under these terms, until at least September 2024. JDK 17 Documentation Java Language Updates […]