Files
l0ng-ai c868ec8b68 fix(java): Apply the Maven settings to jdtls and Lombok, find more Maven installs
Review fixes for the Project JDK / Maven settings:

- jdtls gets the user settings.xml as java.configuration.maven.userSettings, so the
  editor resolves dependencies through the same mirrors and servers as sync and builds.
- The configured local repository (else <localRepository> of the chosen settings.xml)
  is where the static POM model looks for parent POMs / BOMs and where the Lombok
  agent is looked for.
- Maven discovery finds mvn.cmd on PATH on Windows and the homes Maven Wrapper 3.3+
  downloads (dists/<name>/<hash> without a nested folder).
- A Project JDK pointing at the JDK's bin directory is accepted.
- Detected run configurations reload when language settings change, so Maven and
  Gradle runs use the new JDK, Maven home and options.
- Chinese text for the new settings.
2026-10-23 23:15:09 +08:00

26 lines
1.2 KiB
Rust

//! Prints the build model of a folder, optionally after a sync:
//! `cargo run -p ide-build --example model -- <dir> [cache-dir] [maven|gradle]`.
fn main() {
let mut args = std::env::args().skip(1);
let root = std::path::PathBuf::from(args.next().unwrap_or_else(|| ".".into()));
let cache =
args.next().map(std::path::PathBuf::from).unwrap_or_else(|| std::env::temp_dir().join("ide-build-model"));
let cancel = ide_core::CancellationToken::new();
let progress = |p: ide_build::SyncProgress| eprintln!(" {} {:?}", p.message, p.fraction);
let options = ide_build::SyncOptions::default();
let started = std::time::Instant::now();
let synced = match args.next().as_deref() {
Some("maven") => Some(ide_build::sync_maven(&root, &cache, &options, &cancel, &progress)),
Some("gradle") => Some(ide_build::sync_gradle(&root, &cache, &options, &cancel, &progress)),
_ => None,
};
if let Some(r) = synced {
eprintln!("synced in {:?}: {r:?}", started.elapsed());
}
let started = std::time::Instant::now();
let model = ide_build::load(&root, &cache, None);
println!("{}", serde_json::to_string_pretty(&model).unwrap());
eprintln!("loaded in {:?}", started.elapsed());
}