Rate This Document
Findability
Accuracy
Completeness
Readability

Snappy-java-1.1.0.1

Installing sbt

  1. Download sbt-0.13.15 to a specified directory (for example, /opt/tools/installed) and decompress it.
    1
    2
    3
    wget https://github.com/sbt/sbt/releases/download/v0.13.15/sbt-0.13.15.tgz
    tar -zxf sbt-0.13.15.tgz
    mv sbt /opt/tools/installed
    
  2. Create the .sbt folder in the root directory of the current user and copy the repositories file to the .sbt folder.

    The repositories section defines the sequence in which the Maven repositories are used during sbt compilation.

    1
    2
    mkdir ~/.sbt
    cp repositories ~/.sbt
    

    The content of the repositories file is as follows:

    1
    2
    3
    4
    5
    6
    [repositories]
    local
    kunpeng-maven: https://mirrors.huaweicloud.com/kunpeng/maven/
    huawei-maven: https://mirrors.huaweicloud.com/repository/maven/
    sbt-releases-repo: https://repo.typesafe.com/typesafe/ivy-releases/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]
    sbt-plugins-repo: https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]
    
  3. Configure the SBT_HOME environment variable.
    1. Open the /etc/profile file.
      1
      vi /etc/profile
      
    2. Press i to enter the insert mode and add the following content to the profile file:
      1
      2
      export SBT_HOME=/opt/tools/installed/sbt
      export PATH=${SBT_HOME}/bin:${PATH}
      
    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  4. Make the environment variable take effect.
    1
    source /etc/profile
    

Compiling snappy-java-1.1.0.1

  1. Download the source package.
    1
    2
    wget https://github.com/xerial/snappy-java/archive/1.1.0.1.zip --no-check-certificate
    mv 1.1.0.1.zip snappy-java-1.1.0.1.zip
    
  2. Decompress the source package.
    1
    unzip snappy-java-1.1.0.1.zip
    
  3. Go to the directory where the Snappy source package is decompressed.
    1
    cd snappy-java-1.1.0.1
    
  4. Modify the Makefile file.
    1. Open the file.
      1
      vi Makefile
      
    2. Press i to enter the insert mode. In the Makefile file, modify the download URL of the Snappy package (comment out the original download URL and add the new one).
      #curl -o$@ http://snappy.googlecode.com/files/snappy-$(VERSION).tar.gz
      curl -o$@ https://src.fedoraproject.org/repo/pkgs/snappy/snappy-1.1.0.tar.gz/c8f3ef29b5281e78f4946b2d739cea4f/snappy-$(VERSION).tar.gz
    3. In the Makefile file, modify the decompression command (comment out the original decompression command and add the new one).
      # $(TAR) xvfz $< -C $(TARGET)
      $(TAR) xvf $< -C $(TARGET)

    4. Press Esc, type :wq!, and press Enter to save the file and exit.
  5. Compile the source code.
    1
    make
    

    The generated JAR package after the compilation is stored in target/snappy-java-1.1.0.1-SNAPSHOT.jar.

  6. Modify the pom file.
    1
    vi pom.xml
    

  7. Perform the compilation again.
    1
    make
    

    The generated JAR package after the compilation is stored in target/snappy-java-1.1.0.1.jar.