Allow for path to be root.
I would like to be able to drop a pom file directly into the cargo project.
If this is the case the test directory for the pom could be set to test/
The reason for this is to allow for combined rust and java projects in large code bases. Utilizing the maven dependency system will need to be worked outlier.
The project would look like ├── pom.xml |── Cargo.lock ├── Cargo.toml └── src └── main.rs
A few questions first:
- What does your
pom.xmlconfig look like? - What is the actual issue you're experiencing?
- What is the problem you're trying to solve?
I would generally recommend grouping the Rust crate(s) into a dedicated sub-directory, as shown in the example: https://github.com/questdb/rust-maven-plugin/tree/main/rust-maven-jni-example.
Least of reasons would be that if the Rust crate directory and the pom.xml directory are one and the same these would most likely end up fighting over ownership of the <root>/target directory.
As your project evolves and gets larger, you might find yourself wanting to split up your Rust code into multiple crates too. Having a separate directory would certainly help with this too.
If there's a compelling reason to host all the code together, by all means, raise a PR with the desired improvements and I'd be happy to help you achieve your feature request by offering guidance and long term maintenance.
I have a large java/ C++ project that uses ant with many child projects. Each child project generally only contains either java or C++. I am looking at converting the project to maven to start looking at incorporating rust into the project. It does seem kind of clunky to have a src/main/rust/{rust project} when it could be in the home directory.
Now I did not think about ownership of the ${project.build.outputDirectory} in this feature request. Maybe there is a way to buffer the cargo output to a temp file and then move it into the outputDirectory.
This would allow projects to potentially look like a native-maven-plugin project or nar-maven-plugin project if using the ant style of src/ and test/ where everything can look familiar.
One thing after this would be handling build artifacts between child projects in a maven multi module project.
It does not need to be src/rust/crate-name. It can just be crate-name if you like.
It can even be in an altogether different dir, i.e. ../rust/crate-name.
I hope this helps.
So would that be the most desirable structure. Lets take a combined cpp/java/rust
.
├── cpp-project-1
│ ├── pom.xml
│ ├── src
│ │ └── main.cpp
│ └── test
├── cpp-project-2
│ ├── pom.xml
│ ├── src
│ │ └── lib.hpp
│ └── test
├── java-project-1
│ ├── pom.xml
│ └── src
│ └── main
│ └── java
│ └── com
│ └── example
│ └── App.java
├── java-project-2
│ ├── pom.xml
│ └── src
│ └── main
│ └── java
│ └── com
│ └── example
│ └── Lib.java
├── pom.xml
├── rust-project-1
│ ├── Cargo.lock
│ ├── pom.xml
│ └── rust-project-1
│ ├── Cargo.toml
│ └── src
│ └── main.rs
└── rust-project-2
├── pom.xml
└── rust-project-2
├── Cargo.toml
└── src
└── main.rs