Maven debug shows warnings and errors, but eventually compiles

前端 未结 1 1399
别那么骄傲
别那么骄傲 2021-01-25 01:15

As the title puts it, I am facing a strange situation with Maven. Given is the output of my debug process, which I ran with mvn install -X command:

         


        
相关标签:
1条回答
  • 2021-01-25 01:55

    The key point is:

    ..., transitive dependencies (if any) will not be available: ...

    If there aren't any, you're lucky – at the moment. Have you tried to use sampleModule.msg-...jar at runtime already? Does it work?

    (BTW, dots as separators in the <artifactId> are unusal, use hyphens instead.)

    See also Maven / POM Reference, Dependencies:

    • groupId, artifactId, version:
      ...

      Since the dependency is described by Maven coordinates, you may be thinking: "This means that my project can only depend upon Maven artifacts!" The answer is, "Of course, but that's a good thing." This forces you to depend solely on dependencies that Maven can manage. There are times, unfortunately, when a project cannot be downloaded from the central Maven repository. For example, a project may depend upon a jar that has a closed-source license which prevents it from being in a central repository. There are three methods for dealing with this scenario.

      1. Install the dependency locally using the install plugin. The method is the simplest recommended method. For example:

        mvn install:install-file -Dfile=non-maven-proj.jar -DgroupId=some.group -DartifactId=non-maven-proj -Dversion=1 -Dpackaging=jar
        

        Notice that an address is still required, only this time you use the command line and the install plugin will create a POM for you with the given address.

      2. Create your own repository and deploy it there. This is a favorite method for companies with an intranet and need to be able to keep everyone in synch. There is a Maven goal called deploy:deploy-file which is similar to the install:install-file goal (read the plugin's goal page for more information).
      3. Set the dependency scope to system and define a systemPath. This is not recommended, however, but leads us to explaining the following elements:

    ...

    • systemPath:
      Is used only if the the dependency scope is system. Otherwise, the build will fail if this element is set. The path must be absolute, so it is recommended to use a property to specify the machine-specific path (more on properties below), such as ${java.home}/lib. Since it is assumed that system scope dependencies are installed a priori, Maven will not check the repositories for the project, but instead checks to ensure that the file exists. If not, Maven will fail the build and suggest that you download and install it manually.

    [Emphasizes by me.]

    0 讨论(0)
提交回复
热议问题