Maven without (remote) repository?

后端 未结 2 500
隐瞒了意图╮
隐瞒了意图╮ 2021-01-14 10:37

I have a Maven 2 multi-module project and want to be sure everything is taken from my local checked-out source.

  • Is it possible to tell Maven to never download
2条回答
  •  醉梦人生
    2021-01-14 11:00

    Is it possible to tell Maven to never download anything for the modules it has the source of?

    No. Maven 2 only "sees" the current module while it builds. On the plus side, you can build part of the tree by running Maven in a module.

    Do I have to disable the remote repositories?

    Yes, use the "offline" option -o or -offline. Or use settings.xml with a proxy that doesn't have any files. This isn't what you want, though.

    Does Maven always have to go the expensive way of installing a module into the local repository, and then extracting it again for each of its dependents?

    Yes but it's not expensive. During the build, the file is copied (that was expensive ten years ago). When a dependency is used, Maven just adds the path to the file to the Java process. So the file isn't copied or modified again. Maven assumes that files in the local repository don't change (or only change once when a download/install happens).

    Does Maven automatically first recompile dependencies for a module if their local source changed?

    No. There were plans for Maven 3 but I can't find an option to enable something like that.

    To solve your issues, you should install a local proxy (like Nexus).

提交回复
热议问题