Skip to content

ant remove ​

sh
ant remove <name>...

ant remove takes names of the project file, ant.json, and removes their entries. It then selects the versions of the packages that are left and writes ant.lock.

A project with two entries, and a program that uses one of them:

json
{
  "dependencies": {
    "slug": "example.com/slug@2.0.0",
    "slug1": "example.com/slug@1.2.0"
  }
}
ant
import "slug" Slug

println(Slug.make("Hello, Ant"))

ant remove slug1 takes the entry out of ant.json and prints the line that left the lock:

text
- example.com/slug 1.2.0
  • The name is the one in ant.json, under dependencies or devDependencies, not the path of the package.
  • Standard output lists the lines that left the lock. A package that another package still asks for stays in the lock.
  • When the last entry goes, the project needs no lock, and ant remove deletes ant.lock.
  • It changes all or nothing: with a name that is not in the file, it removes none.
  • The store keeps the files of the package. Other projects may use them.
  • ant remove fetches nothing when the store holds the packages that are left.

An import of the name then fails, and the program does not load:

ant
import "slug1" Slug1
// error: cannot import "slug1": the project file ant.json has no dependency named slug1

Exit status ​

Exit statusWhen
0the files were written
1a name is not a dependency, or there is no project file
2the usage is wrong: an unknown flag, no name, or an argument that is not a name, such as a path

See also ​

Packages, ant add, ant update, ant lock