How can I build a specific package in a workspace?
You can use the --package
or -p
flag to cargo build
:
cargo build # build packages listed in the default-members key
cargo build --all # build all packages
cargo build --package foo # build the package "foo"
cargo build -p foo # ditto
The first answer not work with:
error: package ID specification `foo` matched no packages
The correct way is:
find out pkgid
first:
$ cd server
$ cargo pkgid
file:///dw/path/to/server:4.0.0-SNAPSHOT
Goto workspace folder and run build
$ cd -
cargo build -p file:///dw/path/to/server:4.0.0-SNAPSHOT