Question

If I add a Maven project to a project in Intellij and save, I get an error message telling me:

Could not save project: Failed to create child file at /Library/jbox2d/jbox2d-serialization/jbox2d-serialization.iml

It fails due to a lack of write permissions, but why would Maven want to save anything to the Library project?

Wouldn't it make sense to keep the Library dir read only? It's the IntelliJ project I want to modify, after all, not the library.

Was it helpful?

Solution

If you just need to access classes in the library, you don't need to add it as a module to your IDEA project. Instead, add it as a dependency. Since jbox2d is available in Maven Central, you can just click Add -> Library... -> From Maven... and look up for appropriate version of jbox2d-serialization. IDEA will download it with all necessary dependencies.

If you need a newer version than available in Maven Central, you'll have to either download the jars manually and add them as dependencies, or build the library from source, and in that case you do need to add it as a module.

I don't see much sense in keeping Library directory read only. If you want to build library from source, you'll have to write compiled classes and jar somewhere. If you are using pre-built jar, you may want to, for example, update the library later. You don't mark your source code files as read only once you think you're done with them, do you?

OTHER TIPS

Right click on the pom.xml of the project and choose "add as Maven Project"

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top