You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Dennis Lundberg (Jira)" <ji...@apache.org> on 2022/04/25 13:15:00 UTC

[jira] [Comment Edited] (MWAR-448) packaging dependencies fails with "mvn install" but not "mvn package"

    [ https://issues.apache.org/jira/browse/MWAR-448?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17525438#comment-17525438 ] 

Dennis Lundberg edited comment on MWAR-448 at 4/25/22 1:14 PM:
---------------------------------------------------------------

In my opinion what you have described above is working as intended. If you add a dependency on some-parent and don't specify the type, Maven and its plugins will assume that some-parent produces a jar artifact. If some-parent does not produce a jar artifact (as is the case) then some plugins will fail if they cannot find that jar artifact.

So for things to work properly you must specify type=pom in some-parent, as well as any other place that uses some-parent as a dependency.

 


was (Author: dennisl):
In my opinion what you have described above is working as intended. If you add a dependency on some-parent and don't specify the type, Maven and its plugins will assume that some-parent produces a jar artifact. If some-parent does not produce a jar artifact (as is the case) then som plugins will fail if they cannot find that jar artifact.

So for things to work properly you must specify type=pom in some-parent, as well as any other place that uses some-parent as a dependency.

 

> packaging dependencies fails with "mvn install" but not "mvn package"
> ---------------------------------------------------------------------
>
>                 Key: MWAR-448
>                 URL: https://issues.apache.org/jira/browse/MWAR-448
>             Project: Maven WAR Plugin
>          Issue Type: Bug
>    Affects Versions: 3.3.2
>         Environment: maven 3.6.3 ( later versions have bugs which we can't take in)
>            Reporter: Kari J. Niemi
>            Priority: Minor
>             Fix For: waiting-for-feedback
>
>
> I think we discovered a minor odd difference with war-packaging between "mvn package" or "mvn install". We would expect that only difference between the two is that the latter also installs the produced stuff in the local maven repository.
>  
> We are packaging a few jars to a war. We have a parent pom with some modules, and that is defined as a dependency in the pom.xml that produces a war-package. Like this:
> my-war-thingie:pom.xml (packaging:war)
>  * dependency: some-parent
> some-parent:pom.xml (packaging:pom)
>  * module1 (packaging:jar)
>  * module2 (packaging:jar)
> Earlier we had a different structure and everything was just fine: we did not the have the child-modules but the parent-pom produced the jar. When we changed the structure to the one described above: our CI was still OK, some developers building OK as well -but some developers had failing maven builds because of missing "some-parent.jar".
>  
> It was bit of devastating hunt, but finally we discovered that "mvn package" was building OK, but "mvn install" looks for "some-parent.jar".
> We don't actually mind if the above scenario would fail in both cases, or if it was successful - we would just expect that it works the same way for both. If this is intended behaviour, it would be nice to have it documented.
> FWIW: in our case, we anyway wanted to define direct dependencies from the war-packaging to the child-modules. So actually, we are OK wih our builds already. But the difference caused so may doubts about our builds reproducibility - and also, it seems like a bug - so I wanted to be good citizen and report the problem.
> Edit: further note from our troubleshooting sessions: we don't have the "type" for the dependency at all in my-war-thingie:pom.xml. Yesterday, we did experiment setting the type as "pom" -and as a consequence,  both "mvn package" and "mvn install" were successful. The default as we know, should/would be "jar". Maybe the missing dependency type is for some odd reason resolved differently for "maven package" and "maven install"?



--
This message was sent by Atlassian Jira
(v8.20.7#820007)