如何更新 Cargo 中的 git 依赖项?
How do I update git dependencies in Cargo?
我在 Cargo.toml
中有 git URL 引用的 Rust 库依赖项,如下所示:
rust_wheel = { git = "https://github.com/jiangxiaoqiang/rust_wheel.git" }
现在我更改了 git 存储库并想更新我当前项目的依赖项。我尝试使用这个命令:
cargo install rust_wheel --force
但是它显示这个错误:
error: there is nothing to install in `rust_wheel v0.1.0`, because it has no binaries
`cargo install` is only for installing programs, and can't be used with libraries.
To use a library crate, add it as a dependency in a Cargo project instead.
我尝试刷新 Clion 中的货物依赖项。它不起作用。我应该怎么做才能更新依赖项?还尝试了命令 cargo update rust_wheel
.
每当指定来自 git 存储库的依赖项时没有任何其他说明符(即通过属性 rev
、tag
或 branch
),这意味着它被指定为该存储库主分支的最新版本。但无论如何,更新任何依赖项都需要更新项目的 Cargo.lock 文件。这通常意味着使用 cargo update
命令。
cargo update
这还将检测对版本或原始要求的任何更改,并相应地更新依赖锁。
I tried to use this command: cargo install rust_wheel --force
那是错误的 Cargo 命令。 cargo install
用于将二进制文件安装到系统,而不是安装依赖项。这也是well documented。
Also tried cargo update rust_wheel
.
语法错误。要发布 特定 依赖项的更新,请使用 -p
选项。
cargo update -p rust_wheel
另请参阅:
我在 Cargo.toml
中有 git URL 引用的 Rust 库依赖项,如下所示:
rust_wheel = { git = "https://github.com/jiangxiaoqiang/rust_wheel.git" }
现在我更改了 git 存储库并想更新我当前项目的依赖项。我尝试使用这个命令:
cargo install rust_wheel --force
但是它显示这个错误:
error: there is nothing to install in `rust_wheel v0.1.0`, because it has no binaries
`cargo install` is only for installing programs, and can't be used with libraries.
To use a library crate, add it as a dependency in a Cargo project instead.
我尝试刷新 Clion 中的货物依赖项。它不起作用。我应该怎么做才能更新依赖项?还尝试了命令 cargo update rust_wheel
.
每当指定来自 git 存储库的依赖项时没有任何其他说明符(即通过属性 rev
、tag
或 branch
),这意味着它被指定为该存储库主分支的最新版本。但无论如何,更新任何依赖项都需要更新项目的 Cargo.lock 文件。这通常意味着使用 cargo update
命令。
cargo update
这还将检测对版本或原始要求的任何更改,并相应地更新依赖锁。
I tried to use this command:
cargo install rust_wheel --force
那是错误的 Cargo 命令。 cargo install
用于将二进制文件安装到系统,而不是安装依赖项。这也是well documented。
Also tried
cargo update rust_wheel
.
语法错误。要发布 特定 依赖项的更新,请使用 -p
选项。
cargo update -p rust_wheel
另请参阅: