Can I add jars to maven 2 build classpath without installing them?

前端 未结 24 2879
萌比男神i
萌比男神i 2020-11-22 01:41

Maven2 is driving me crazy during the experimentation / quick and dirty mock-up phase of development.

I have a pom.xml file that defines the dependenc

24条回答
  •  轮回少年
    2020-11-22 02:01

    Using system is a terrible idea for reasons explained by others, installing the file manually to your local repository makes the build unreproducible, and using file://${project.basedir}/repo is not a good idea either because (1) that may not be a well-formed file URL (e.g. if the project is checked out in a directory with unusual characters), (2) the result is unusable if this project’s POM is used as a dependency of someone else’s project.

    Assuming you are unwilling to upload the artifact to a public repository, Simeon’s suggestion of a helper module does the job. But there is an easier way now…

    The Recommendation

    Use non-maven-jar-maven-plugin. Does exactly what you were asking for, with none of the drawbacks of the other approaches.

提交回复
热议问题