Lets says:
B is a library which depends on CommonLib
App depends on B and CommonLib
Here are their mainfests
B's Package.swift:
import PackageDescription
let package = Package(
name: "B",
products: [
.library(
name: "B",
targets: ["B"]),
],
dependencies: [
.package(url: "https://.../CommonLib", from: "1.0.0"),
],
targets: [
.target(
name: "B",
dependencies: ["CommonLib"]),
.testTarget(
name: "BTests",
dependencies: ["B"]),
]
)
App's Package.swift
import PackageDescription
let package = Package(
name: "App",
dependencies: [
.package(url: "https://.../CommonLib", from: "1.0.0"),
.package(url: "https://.../B", from: "1.0.0"),
],
targets: [
.target(
name: "App",
dependencies: ["CommonLib", "B"]),
.testTarget(
name: "AppTests",
dependencies: ["App"]),
]
)
swift build
error: Found multiple packages with the name CommonLib...
If both App and B depend on CommonLib and if I import B and CommonLib into App there is an error Found multiple packages with the name...
Apple Swift version 4.0.2 (swiftlang-900.0.69.2 clang-900.0.38) Target: x86_64-apple-macosx10.9
Does anyone know how to resolve this?
Remove Package.pins
and rerun swift build
. See which packages it is trying to fetch. Check .build/checkouts
and .build/dependencies-state.json
- which tags and which versions, respectively, of CommonLib, are written there.