master
ehlxr 2022-11-14 13:36:35 +08:00
commit fd8c563be7
5 changed files with 104 additions and 0 deletions

33
.gitignore vendored Normal file
View File

@ -0,0 +1,33 @@
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/

1
READEME.md Normal file
View File

@ -0,0 +1 @@
`native-image -cp "target/classes:lib/*" io.github.ehlxr.murmur3.Murmur3Applicatio` built as a standalone executable

BIN
lib/guava-31.0.1-jre.jar Normal file

Binary file not shown.

55
pom.xml Normal file
View File

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>io.github.ehlxr</groupId>
<artifactId>murmur3</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>murmur3</name>
<description>murmur3</description>
<properties>
<java.version>1.8</java.version>
<!--目标编译的 Java 版本可以通过以下属性指定,不用配置 maven-compiler-plugin 插件-->
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>31.1-jre</version>
</dependency>
</dependencies>
<build>
<plugins>
<!-- 使用maven-shade-plugin插件打包 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.3</version>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>io.github.ehlxr.murmur3.Murmur3Application</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,15 @@
package io.github.ehlxr.murmur3;
import com.google.common.base.Charsets;
import com.google.common.hash.Hashing;
/**
* @author ehlxr
*/
public class Murmur3Application {
public static void main(String[] args) {
for (String arg : args) {
System.out.println(arg + " => " + Math.abs(Hashing.murmur3_32_fixed().hashString(arg, Charsets.UTF_8).asInt()));
}
}
}