Regarding this commit GitHub - malwaredb/malwaredb-rs at 1cdbab09ad36915758c921f3265d96bf8d6a85e8...
I'm working on a client/server system, where the server is the main project, some common items are sub-crates in crates/
, and a client application in client/
. I'm using Cargo workspaces, and I've run into a weird issue.
I'm trying to use the reqwest
crate in the client/
sub-crate, and if I'm in the client/
directory, cargo build
works fine. However, if I'm in the project directory, cargo build
fails with use of undeclared crate or module 'reqwest'
. The Cargo.toml file for the project has reqwest
listed in [workspace.dependencies]
, and client/Cargo.toml
has request = { workspace = true }
.
If I add reqwest
as a crate for the root project in [dependencies]
, then building in the root directory works fine. Am I missing something?
The sub-crate crates/server
has workspace dependencies not listed as [dependencies]
in the root Cargo.toml, and it works fine. Also, trying to move client/
to crates/client/
didn't help.
Root Cargo.toml
[workspace.dependencies]
reqwest = { version = "0.11.6", features = ["blocking", "json", "deflate", "gzip"], default-features = false }
[workspace]
resolver = "2"
members = [
'crates/api',
'crates/types',
'crates/server',
'client',
]
client/Cargo.toml
reqwest = { workspace = true }
PWD=${PROJECT_HOME}/client/
: cargo build
works fine!
PWD=${PROJECT_HOME}/
: cargo build
has the error: undeclared crate or module 'reqwest'