I encountered some problems when trying to publish

error:

error: crates cannot be published to crates.io with dependencies sourced from other
registries. `log` needs to be published to crates.io before publishing this crate.
(crate `log` is pulled from registry `crates-io`)


error: crates cannot be published to crates.io with dependencies sourced from other
registries. `async-trait` needs to be published to crates.io before publishing this crate.
(crate `async-trait` is pulled from registry `crates-io`)

You should post your Cargo.toml.

my file

[package]
name = "mybatis-plus"
version = "1.0.0"
edition = "2021"
rust-version = "1.59.0"
authors = ["James Zow <Jameszow@163.com>"]
license = "Apache-2.0 license"
description = "mybatis plus"

[features]
default = ["default_mode", "all-database"]
#debug_mode feature will show decode json data
debug_mode = ["mybatis-core/debug_mode", "macros/debug_mode"]
default_mode = ["mybatis-core", "macros"]
#support upper case sql keyword
upper_case_sql_keyword = []
#runtime  database
all-database = ["default_mode", "mybatis-core/all-database"]
mysql = ["default_mode", "mybatis-core/mysql"]
postgres = ["default_mode", "mybatis-core/postgres"]
sqlite = ["default_mode", "mybatis-core/sqlite"]
mssql = ["default_mode", "mybatis-core/mssql"]

#choose runtime
runtime-tokio-rustls = ["mybatis-core/runtime-tokio-rustls"]
runtime-actix-rustls = ["mybatis-core/runtime-actix-rustls"]
runtime-async-std-rustls = ["mybatis-core/runtime-async-std-rustls"]
runtime-tokio-native-tls = ["mybatis-core/runtime-tokio-native-tls"]
runtime-actix-native-tls = ["mybatis-core/runtime-actix-native-tls"]
runtime-async-std-native-tls = ["mybatis-core/runtime-async-std-native-tls"]

#enable_format bson
format_bson = ["mybatis-core/format_bson"]

[dependencies]
macros = { version = "1.0.0", path = "../macros", default-features = false, optional = true }
mybatis-core = { version = "1.0.0", path = "../mybatis-core", default-features = false, optional = true }
mybatis-util = { version = "1.0.0", path = "../mybatis-util", default-features = false}
mybatis-sql = { version = "1.0.0", path = "../mybatis-sql", default-features = false}

################################################################
rbson = { version = "2.0.3", features = ["uuid-0_8", "chrono-0_4"] }
chrono = { version = "0.4", features = ["serde"] }
#serde
serde = { version = "1", features = ["derive"] }
#uuid
uuid = { version = "0.8", features = ["serde", "v4"] }
#log
log = { version = "0.4", default-features = false }
#async trait
async-trait = "0.1.53"
futures-core = { version = "0.3" }
futures = { version = "0.3" }
once_cell = "1.10"
#object_id
hex = "0.4"
rand = "0.8"

[dev-dependencies]
serde_json = "1"

[profile.release]
lto = true
opt-level = 3
codegen-units = 1

I rely on log and async-trait , crates.io How should I publish the package

There is something strange going on here. You should not need to do anything special to publish a crate to crates.io that depends on log and async-trait from crates.io. The error message doesn't make sense, because your dependencies aren't “dependencies sourced from other registries”.

I don't have an idea for how to troubleshoot this, but it's not just a mistake in your code. Maybe something is long with your local Cargo registry information in ~/.cargo/, somehow?

1 Like

When I build, I success, and there is an error in publish

cargo package --allow-dirty

success
➜  mybatis-drive git:(v-1.0.1) ✗ cargo publish --allow-dirty
warning: profiles for the non root package will be ignored, specify profiles at the workspace root:
package:   /Users/jameszow/Documents/RustWorkSpace/summer-mybatis/mybatis-core/Cargo.toml
workspace: /Users/jameszow/Documents/RustWorkSpace/summer-mybatis/Cargo.toml
    Updating `ustc` index
error: crates cannot be published to crates.io with dependencies sourced from other
registries. `base64` needs to be published to crates.io before publishing this crate.
(crate `base64` is pulled from registry `crates-io`)

cargo check and cargo test and cargo package It was successful

my cargo config file:

[source.crates-io]
registry = "https://github.com/rust-lang/crates.io-index"
replace-with = 'ustc'
[source.ustc]
registry = "git://mirrors.ustc.edu.cn/crates.io-index"

This looks like:

https://github.com/rust-lang/crates.io/issues/2249

1 Like

I've read it, but I still don't have a clear solution. In our country, if you don't replace the source, cargo download is very slow, Thank you very much for helping me find the problem

If the problem is “only” crates.io being slow, you could maybe temporarily disable the config only while executing cargo publish? Although, during publishing, I guess cargo might possibly want to re-download all the crates from the new source then, so the cargo publish invocation might be slow, too? I don’t know whether or not that would be the case. And I don’t know either if the slowness is only a slight inconvenience or if it’s so significantly slow that it takes ages to complete (which might also depend on the number of dependencies, I guess..)

It is very slow, just like Java Maven's warehouse. In our country, it is pulled with replacement sources. This has a certain relationship with network speed and bandwidth. I think we can track this problem, because it has not been reasonably solved for 2 years, and its error prompt is very misleading to developers

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.