Showing posts with label POM. Show all posts
Showing posts with label POM. Show all posts

Monday, April 5, 2021

Dependency Management vs Dependencies POM Maven Difference

What is the difference between dependencyManagement and dependencies?

https://stackoverflow.com/questions/11778276/what-is-the-difference-between-pom-type-dependency-with-scope-import-and-wit/11782691#11782691

Its need to declare dependencies in child project pom's anyway even if they declared in parent project's pom at <dependencyManagement> section

You cannot have a pom type project as a simple dependency in another project. (Well, you can - but it will not do anything useful). There can only be a parent-child relationship. This is essentially managing dependency through inheritance.

import scope for pom type dependency in <dependencyManagement> section allows you to achieve the equivalent of multiple inheritance.


You can only import managed dependencies. This means you can only import other POMs into the dependencyManagement section of your project's POM. i.e.


<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>other.pom.group.id</groupId>
            <artifactId>other-pom-artifact-id</artifactId>
            <version>SNAPSHOT</version>
            <scope>import</scope>
            <type>pom</type>
        </dependency>   
    </dependencies>
</dependencyManagement>

What then happens is that all the dependencies defined in the dependencyManagement section of the other-pom-artifact-id are included in your POM's dependencyManagement section. You can then reference these dependencies in the dependency section of your POM (and all of its child POMs) without having to include a version etc.

maven command line how to point to a specific settings.xml for a single command?

https://stackoverflow.com/questions/25277866/maven-command-line-how-to-point-to-a-specific-settings-xml-for-a-single-command/25279325#25279325

We usually keep settings.xml in ~/.m2/settings.xml

But its kind of makes it global

What if we want to have our own local settings.xml instead of default and global one,

You can simply use:

mvn --settings YourOwnSettings.xml clean install

or

mvn -s YourOwnSettings.xml clean install


Azure - Pipeline - Add Approver for Stage

https://learn.microsoft.com/en-us/azure/devops/pipelines/process/approvals?view=azure-devops&tabs=check-pass