bash 如何通过bash脚本设置最新版本的liquibase?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24286635/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to setup latest version of liquibase through bash script?
提问by sakhunzai
I used to install liquibase older version e.g
我曾经安装 liquibase 旧版本,例如
`wget https://github.com/downloads/liquibase/liquibase/liquibase-2.0.5-bin.tar.gz`
and proceed with extraction and move it to desired location . I am unable to locate latest version of liquibase on github. Probably its removed or unavailable ?
并继续提取并将其移动到所需位置。我无法在 github 上找到最新版本的 liquibase。可能它已删除或不可用?
Liquibase download pagehas only link to source-forge , could someone help me how to wget
a package from source-forge ?
Liquibase 下载页面只有 source- forge 的链接,有人可以帮助我如何wget
从 source- forge 下载包吗?
EditI am not sure of github, it seems there are no builds available for latest version. However, my complete script looks like this:
编辑我不确定 github,似乎没有可用于最新版本的构建。但是,我的完整脚本如下所示:
#!/bin/bash
sudo apt-get update
sudo apt-get install -y openjdk-7-jre-headless
sudo apt-get install -y libmysql-java
LV="3.1.1"
function setupLiquibase(){
source $HOME/.profile
INSTALLED="$(command -v liquibase)"
# if not added already
if [ -z "$LIQUIBASE_HOME" ]
then
echo 'export MYSQL_JCONNECTOR=/usr/share/java/mysql-connector-java.jar'|sudo tee -a $HOME/.profile
echo 'export LIQUIBASE_HOME=/usr/local/liquibase' |sudo tee -a $HOME/.profile
echo 'export PATH=$PATH:$LIQUIBASE_HOME'|sudo tee -a $HOME/.profile
fi
if [ -z "$INSTALLED" ]
then
echo "Installing liquibase $LV "
sudo rm -rf liquibase*
wget http://kaz.dl.sourceforge.net/project/liquibase/Liquibase%20Core/liquibase-"$LV"-bin.tar.gz
gunzip liquibase-"$LV"-bin.tar.gz
sudo mkdir /usr/local/liquibase
sudo tar -xf liquibase-"$LV"-bin.tar -C /usr/local/liquibase
sudo chmod +x /usr/local/liquibase/liquibase
else
INSTALLED="$(liquibase --version)"
echo "Liquibase is already installed, ${INSTALLED}"
fi
}
setupLiquibase
采纳答案by Hastur
Try to download it with this command line
尝试使用此命令行下载它
wget http://sourceforge.net/projects/liquibase/files/Liquibase%20Core/liquibase-3.2.0-bin.tar.gz/download -O liquibase-3.2.0-bin.tar.gz
To choose a filename for the download you can specify the option -O nomefile
(Note that it is a capital o not a 0).
要为下载选择文件名,您可以指定选项-O nomefile
(请注意,它是大写字母 o 而不是 0)。
If you forget (like I did the first time) to specify -O nomefile you will have on the hard disk a file with the name as guessed by wget. So:
如果您忘记(就像我第一次那样)指定 -O nomefile,您将在硬盘上拥有一个名称为 wget 猜测的文件。所以:
http://Site/FullPath/liquibase-3.2.0-bin.tar.gz/download --> download
and after you have to rename by handsthe file download
.
并且在您必须手动重命名文件之后download
。
If instead it was
相反,如果是
http://Site/FullPath/liquibase-3.2.0-bin.tar.gz --> liquibase-3.2.0-bin.tar.gz
you will have directly the file with the correct name.
您将直接获得具有正确名称的文件。
回答by Louis Kottmann
Github moved downloads section to /release
.
Github 将下载部分移至/release
.
So your url becomes:
所以你的网址变成:
https://github.com/liquibase/liquibase/archive/liquibase-parent-3.2.0.tar.gz
回答by Mark O'Connor
I use apache ivyto download liquibase and its database driver dependencies from Maven Central.
我使用apache ivy从Maven Central下载 liquibase 及其数据库驱动程序依赖项。
Ivy itself is just a jar and can also be downloadedfrom Maven Central.
Ivy 本身只是一个 jar,也可以从 Maven Central下载。
Example
例子
This example runs a standard liquibase changeset and creates a h2database. The bash script will download and cache required jars.
此示例运行标准的 liquibase 变更集并创建一个h2数据库。bash 脚本将下载并缓存所需的 jar。
├── changesets
│?? └── scottTiger.xml
├── ivy.xml
├── liquibase.properties
└── liquibase.sh
Run as follows
运行如下
./liquibase.sh update
liquibase.sh
liquibase.sh
Apache ivy can be used as an executable jar.
Apache ivy 可以用作可执行的 jar。
#!/bin/bash
java -jar $HOME/.ant/lib/ivy.jar \
-error \
-ivy ivy.xml \
-main liquibase.integration.commandline.Main \
-args $@
ivy.xml
常春藤.xml
<ivy-module version="2.0">
<info organisation="com.myspotontheweb" module="demo"/>
<dependencies>
<dependency org="org.liquibase" name="liquibase-core" rev="latest.release" conf="default"/>
<dependency org="com.h2database" name="h2" rev="latest.release" conf="default"/>
</dependencies>
</ivy-module>
liquibase.properties
liquibase.properties
url=jdbc:h2:./db/scottTiger
driver=org.h2.Driver
username=user
password=pass
changeLogFile=changesets/scottTiger.xml
logLevel=info
回答by xameeramir
To install Liquibase, you need to follow the below steps
要安装 Liquibase,您需要按照以下步骤操作
- Install and extract Liquibase binaries
- Install Java JDK
- Install your database's JDBC driver
- Make Liquibase accessible across OS by setting Path variable
- 安装和提取Liquibase 二进制文件
- 安装Java JDK
- 安装数据库的 JDBC 驱动程序
- 通过设置 Path 变量使 Liquibase 可跨操作系统访问
The detailed steps are here
详细步骤在这里
回答by EduardoFernandes
I was facing the same issue. Use the following command: wget https://github.com/liquibase/liquibase/releases/download/v3.8.1/liquibase-3.8.1.tar.gz
我面临同样的问题。使用以下命令:wget https://github.com/liquibase/liquibase/releases/download/v3.8.1/liquibase-3.8.1.tar.gz
For you to get the correct URL, go to the liquibase download pageand use the browser inspect function in the URL. There you will get the correct link to use with wget
.
为了获得正确的 URL,请转到 liquibase下载页面并使用 URL 中的浏览器检查功能。在那里您将获得与wget
.