|
| 1 | +# deps-maven |
| 2 | + |
| 3 | +[](https://crates.io/crates/deps-maven) |
| 4 | +[](https://docs.rs/deps-maven) |
| 5 | +[](https://codecov.io/gh/bug-ops/deps-lsp) |
| 6 | +[](../../LICENSE) |
| 7 | + |
| 8 | +pom.xml support for deps-lsp. |
| 9 | + |
| 10 | +This crate provides Maven/JVM ecosystem support for the deps-lsp server, including pom.xml parsing, dependency extraction, and Maven Central registry integration. |
| 11 | + |
| 12 | +## Features |
| 13 | + |
| 14 | +- **XML Parsing** — Parse `pom.xml` with byte-accurate position tracking using `quick-xml` SAX reader |
| 15 | +- **Dependency Sections** — Handle `<dependencies>`, `<dependencyManagement>`, and `<build><plugins>` blocks |
| 16 | +- **Maven Central Registry** — Solr API client for version lookups and artifact search |
| 17 | +- **Version Comparison** — Maven version qualifier support (`alpha`, `beta`, `RC`, `SNAPSHOT`, `GA`) |
| 18 | +- **Property Resolution** — Resolve `${property}` placeholders defined in `<properties>` |
| 19 | +- **Scope Handling** — Recognise `compile`, `test`, `provided`, `runtime`, and `import` scopes |
| 20 | +- **Ecosystem Trait** — Implements `deps_core::Ecosystem` trait |
| 21 | + |
| 22 | +## Usage |
| 23 | + |
| 24 | +```toml |
| 25 | +[dependencies] |
| 26 | +deps-maven = "0.7" |
| 27 | +``` |
| 28 | + |
| 29 | +```rust |
| 30 | +use deps_maven::{parse_pom_xml, MavenCentralRegistry}; |
| 31 | + |
| 32 | +let result = parse_pom_xml(content, &uri)?; |
| 33 | +let registry = MavenCentralRegistry::new(cache); |
| 34 | +let versions = registry.get_versions_typed("org.springframework:spring-core").await?; |
| 35 | +``` |
| 36 | + |
| 37 | +## Supported pom.xml Syntax |
| 38 | + |
| 39 | +```xml |
| 40 | +<project> |
| 41 | + <properties> |
| 42 | + <spring.version>6.1.0</spring.version> |
| 43 | + </properties> |
| 44 | + |
| 45 | + <dependencies> |
| 46 | + <dependency> |
| 47 | + <groupId>org.springframework</groupId> |
| 48 | + <artifactId>spring-core</artifactId> |
| 49 | + <version>6.1.0</version> |
| 50 | + </dependency> |
| 51 | + <dependency> |
| 52 | + <groupId>junit</groupId> |
| 53 | + <artifactId>junit</artifactId> |
| 54 | + <version>4.13.2</version> |
| 55 | + <scope>test</scope> |
| 56 | + </dependency> |
| 57 | + </dependencies> |
| 58 | + |
| 59 | + <dependencyManagement> |
| 60 | + <dependencies> |
| 61 | + <dependency> |
| 62 | + <groupId>org.springframework.boot</groupId> |
| 63 | + <artifactId>spring-boot-dependencies</artifactId> |
| 64 | + <version>3.2.0</version> |
| 65 | + <type>pom</type> |
| 66 | + <scope>import</scope> |
| 67 | + </dependency> |
| 68 | + </dependencies> |
| 69 | + </dependencyManagement> |
| 70 | + |
| 71 | + <build> |
| 72 | + <plugins> |
| 73 | + <plugin> |
| 74 | + <groupId>org.apache.maven.plugins</groupId> |
| 75 | + <artifactId>maven-compiler-plugin</artifactId> |
| 76 | + <version>3.12.1</version> |
| 77 | + </plugin> |
| 78 | + </plugins> |
| 79 | + </build> |
| 80 | +</project> |
| 81 | +``` |
| 82 | + |
| 83 | +## License |
| 84 | + |
| 85 | +[MIT](../../LICENSE) |
0 commit comments