发布到maven仓库
This commit is contained in:
parent
2fff485de6
commit
32bf2d0773
43
README.md
43
README.md
@ -1,6 +1,6 @@
|
||||
# EasyCaptcha
|
||||
|
||||
![JitPack](https://img.shields.io/jitpack/v/whvcse/EasyCaptcha.svg?style=flat-square)
|
||||
![MavenCentral](https://img.shields.io/maven-central/v/com.github.whvcse/easy-captcha)
|
||||
![Hex.pm](https://img.shields.io/hexpm/l/plug.svg?style=flat-square)
|
||||
|
||||
|
||||
@ -53,52 +53,33 @@
|
||||
## 3.导入项目
|
||||
|
||||
### 3.1.gradle方式的引入
|
||||
需要先在project的build.gradle中添加:
|
||||
```text
|
||||
allprojects {
|
||||
repositories {
|
||||
maven { url 'https://jitpack.io' }
|
||||
}
|
||||
}
|
||||
```
|
||||
在项目的build.gradle中添加
|
||||
```text
|
||||
dependencies {
|
||||
compile 'com.github.whvcse:EasyCaptcha:1.6.2'
|
||||
compile 'com.github.whvcse:easy-captcha:1.6.2'
|
||||
}
|
||||
```
|
||||
|
||||
### 3.2.maven方式引入
|
||||
在你的pom.xml中添加如下代码:
|
||||
```xml
|
||||
<project>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.github.whvcse</groupId>
|
||||
<artifactId>EasyCaptcha</artifactId>
|
||||
<version>1.6.2</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.github.whvcse</groupId>
|
||||
<artifactId>easy-captcha</artifactId>
|
||||
<version>1.6.2</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
```
|
||||
|
||||
### 3.3.jar包下载
|
||||
[EasyCaptcha-1.6.2.jar](https://gitee.com/whvse/EasyCaptcha/releases)
|
||||
[easy-captcha-1.6.2.jar](https://gitee.com/whvse/EasyCaptcha/releases)
|
||||
|
||||
maven导入jar包,在项目根目录创建`libs`文件夹,然后pom.xml添加如下:
|
||||
```
|
||||
<dependency>
|
||||
<groupId>com.github.whvcse</groupId>
|
||||
<artifactId>EasyCaptcha</artifactId>
|
||||
<artifactId>easy-captcha</artifactId>
|
||||
<version>1.6.1</version>
|
||||
<systemPath>${basedir}/libs/EasyCaptcha-1.6.2.jar</systemPath>
|
||||
<systemPath>${basedir}/libs/easy-captcha-1.6.2.jar</systemPath>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
|
127
pom.xml
127
pom.xml
@ -2,16 +2,52 @@
|
||||
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>
|
||||
|
||||
<groupId>org.wf</groupId>
|
||||
<groupId>com.github.whvcse</groupId>
|
||||
|
||||
<artifactId>easy-captcha</artifactId>
|
||||
<version>1.6.2-RELEASE</version>
|
||||
<version>1.6.2</version>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>8</source>
|
||||
<target>8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>EasyCaptcha</name>
|
||||
<description>Java图形验证码,支持gif验证码、中文验证码,适用于Java Web、JavaSE项目。</description>
|
||||
<description>Java web graphics verification code, support gif verification code.</description>
|
||||
<url>https://github.com/whvcse/EasyCaptcha</url>
|
||||
|
||||
<licenses>
|
||||
<license>
|
||||
<name>The Apache Software License, Version 2.0</name>
|
||||
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
|
||||
</license>
|
||||
</licenses>
|
||||
<developers>
|
||||
<developer>
|
||||
<name>whvcse</name>
|
||||
<email>whvcse@foxmail.com</email>
|
||||
</developer>
|
||||
</developers>
|
||||
<scm>
|
||||
<connection>scm:git@github.com:whvcse/EasyCaptcha.git</connection>
|
||||
<developerConnection>scm:git@github.com:whvcse/EasyCaptcha.git</developerConnection>
|
||||
<url>https://github.com/whvcse/EasyCaptcha</url>
|
||||
</scm>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!-- j2ee环境 -->
|
||||
<dependency>
|
||||
@ -28,28 +64,65 @@
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>6</source>
|
||||
<target>6</target>
|
||||
<encoding>UTF-8</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>rdc-releases</id>
|
||||
<url>https://repo.rdc.aliyun.com/repository/70786-release-exL3mB/</url>
|
||||
</repository>
|
||||
<snapshotRepository>
|
||||
<id>rdc-snapshots</id>
|
||||
<url>https://repo.rdc.aliyun.com/repository/70786-snapshot-Y0tgOa/</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>release</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<!-- Source -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>2.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>jar-no-fork</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!-- Javadoc -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.9.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!-- GPG -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<version>1.5</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>sign</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<distributionManagement>
|
||||
<snapshotRepository>
|
||||
<id>oss</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
|
||||
</snapshotRepository>
|
||||
<repository>
|
||||
<id>oss</id>
|
||||
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
@ -1,14 +1,12 @@
|
||||
package com.wf.captcha.base;
|
||||
|
||||
import sun.misc.BASE64Encoder;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.geom.CubicCurve2D;
|
||||
import java.awt.geom.QuadCurve2D;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Base64;
|
||||
|
||||
/**
|
||||
* 验证码抽象类
|
||||
@ -111,18 +109,23 @@ public abstract class Captcha extends Randoms {
|
||||
*/
|
||||
public abstract boolean out(OutputStream os);
|
||||
|
||||
/**
|
||||
* 输出base64编码
|
||||
*
|
||||
* @return base64编码字符串
|
||||
*/
|
||||
public abstract String toBase64();
|
||||
|
||||
/**
|
||||
* 输出base64编码
|
||||
*
|
||||
* @param type 编码头
|
||||
* @return
|
||||
* @return base64编码字符串
|
||||
*/
|
||||
public String toBase64(String type) {
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
out(outputStream);
|
||||
return type + new BASE64Encoder().encode(outputStream.toByteArray());
|
||||
return type + Base64.getEncoder().encodeToString(outputStream.toByteArray());
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user