Maven multi project issue - maven

I am having some issues with my multi-project Maven project.
The problem is the following:
I have a project that organized in the following way:
root
+-- pom.xml
!
+-- module1
! +-- pom.xml
+-- module2
+-- pom.xml
Where module2 depends on module1.
Module1 is packaged as war, it also generates jar file that module2 depends on.
Everything is fine whenever the changes are only in module2 i.e. module1.jar is already in remote repo, however whenever there are changes in both modules during mvn clean release:clean release:prepare release:perform I get an error saying that module1.jar could not be found in remote repo.
So to fix that I have added maven-install-plugin to the Module1's pom file like this:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<file>${project.build.directory}/${project.artifactId}-${project.version}.jar</file>
<!-- <packaging>jar</packaging> -->
</configuration>
<executions>
<execution>
<id>install</id>
<phase>compile</phase>
<goals>
<goal>install</goal>
</goals>
</execution>
</executions>
whenever i comment out <packaging>jar</packaging> it tries to install Module1 jar file into local repo as war file (I am guessing that by default it would pick up packaging from the POM file). So i get something like this:
[INFO] [INFO] [jar:jar {execution: creation}]
[INFO] [INFO] Building jar: ${project.build.directory}/${project.artifactId}-${project.version}.jar
[INFO] [INFO] [install:install {execution: install}]
[INFO] [INFO] Installing ${project.build.directory}/${project.artifactId}-${project.version}.jar to <.m2_local_repo>/<proper_path>/${project.version}/${project.artifactId}-${project.version}.war
However if i un-comment <packaging>jar</packaging> it complains that i am attempting to set a read-only property.
So the question i have, how can i install jar file to my local repo during my build?
Updating the question w/ some parts of module1 and module2 pom files:
module2 pom parts:
<parent>
<groupId>...</groupId>
<artifactId>...</artifactId>
<version>1.01-SNAPSHOT</version>
</parent>
<artifactId>module2</artifactId>
<version>1.08-SNAPSHOT</version>
<packaging>war</packaging>
...
<dependency>
<groupId>...</groupId>
<artifactId>module1</artifactId>
<version>4.18-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
module1 pom:
<parent>
<groupId>...</groupId>
<artifactId>...</artifactId>
<version>1.01-SNAPSHOT</version>
</parent>
<artifactId>module1</artifactId>
<version>4.18-SNAPSHOT</version>
<packaging>war</packaging>
i added install plugin to make sure that module1.4.18.jar will be installed locally so that module2.0.18.war will be able to use module1.4.18.jar

eventually i went with <goal>install-file</goal> instead of <goal>install</goal>
this way i was able to specify proper packaging (it turns out that packaging on install goal is read only, but you can override it for install-file)
so this is what i end up with:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.1</version>
<executions>
<execution>
<id>install</id>
<phase>compile</phase>
<goals>
<goal>install-file</goal>
</goals>
<configuration>
<file>${project.build.directory}/${project.artifactId}-${project.version}.jar</file>
<packaging>jar</packaging>
</configuration>
</execution>
</executions>
</plugin>
#MariuszS and #WIll- thank you for your insight on this matter

I think your project has wrong configuration (not in maven way). Proper configuration looks like this
* parent (root)
* module1 (war1)
* module2 (war2)
* jar (shared code from war2)
Move your code from war to separate module and add this module as depdency to both war modules.

Related

How to resolve parent pom dependency issue: Failed to read artifact descriptor; Could not find artifact?

I recently published three artifacts to Maven Central: https://search.maven.org/search?q=ced2ar3-rdb
The three are part of the same project and are published concurrently.
I'm now trying to build a new project using ced2ar-rdb and ced2ar-rdb-tests as dependencies, but not where in my code do I reference the parent pom file (ced2ar3-rdb-parent; I don't actually want to use it and didn't think I needed it). However, when I try to build my project that uses ced2ar-rdb as a dependency, I get this error:
[ERROR] Failed to execute goal on project ced2ar3-services-core: Could not resolve dependencies for project edu.cornell.
ncrn.ced2ar:ced2ar3-services-core:jar:0.0.0: Failed to collect dependencies at edu.cornell.ncrn.ced2ar:ced2ar3-rdb:jar:0
.0.1: Failed to read artifact descriptor for edu.cornell.ncrn.ced2ar:ced2ar3-rdb:jar:0.0.1: Could not find artifact edu.
cornell.ncrn.ced2ar:ced2ar3-rdb-parent:pom:${ced2ar.version} in central (https://repo.maven.apache.org/maven2) -> [Help
Is the issue related to the fact that I have <version>${ced2ar.version}</version> in the parent pom, even though ${ced2ar.version} appears correctly defined in <properties> further down in the file?
Is the issue related to the fact that I have
${ced2ar.version} in the parent pom, even though
${ced2ar.version} appears correctly defined in further
down in the file?
No, the problem comes from the way which you declared the child modules.
Here is an extract of the rdb module pom.
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>ced2ar3-rdb-parent</artifactId>
<groupId>edu.cornell.ncrn.ced2ar</groupId>
<version>${ced2ar.version}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>ced2ar3-rdb</artifactId>
</project>
The ${ced2ar.version} property defined in the parent version of the child project cannot be resolved without building the reactor project that first builds the parent pom that defines this property. That's why your build works in development (with the reactor) but doesn't work without it.
To solve your issue you could use the revision standard property with the flatten-maven-plugin that will help you to set a unique version between the parent and the child.
Your reactor pom could look like :
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>my-group</groupId>
<artifactId>my-parent</artifactId>
<version>${revision}</version>
...
<properties>
<revision>1.0.0</revision>
</properties>
<modules>
<module>rdb</module>
<module>rdb-tests</module>
..
</modules>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<version>1.0.0</version>
<configuration>
<updatePomFile>true</updatePomFile>
</configuration>
<executions>
<execution>
<id>flatten</id>
<phase>process-resources</phase>
<goals>
<goal>flatten</goal>
</goals>
</execution>
<execution>
<id>flatten.clean</id>
<phase>clean</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
And the rdb pom.xml for example like that :
<project>
<parent>
<groupId>my-group</groupId>
<artifactId>my-parent</artifactId>
<version>${revision}</version>
</parent>
<artifactId>rdb</artifactId>
...
</project>
About your comment :
I get an invalid POM error with: "Project name missing, Project
description missing, Project URL missing, SCM URL missing, Developer
information missing". Indeed, after inspecting the generated
.flattened-pom.xml, I do not see these fields
it is expected as the flattened plugin strips some metadata of the original POM :
The flattened POM is a reduced version of the original POM with the
focus to contain only the important information for consuming it.
Therefore information that is only required for maintenance by
developers and to build the project artifact(s) are stripped. Starting
from here we specify how the flattened POM is created from the
original POM and its project
But you can override this default by adding the elements that you don't want to strip in the pomElements parameter of the plugin.
For example :
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<version>1.0.0</version>
<configuration>
<updatePomFile>true</updatePomFile>
<pomElements>
<name/>
<description/>
<developers/>
<contributors/>
<url/>
<scm/>
</pomElements>
</configuration>
<executions>
<execution>
<id>flatten</id>
<phase>process-resources</phase>
<goals>
<goal>flatten</goal>
</goals>
</execution>
<execution>
<id>flatten.clean</id>
<phase>clean</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
This works well for child modules that are directly under the parent module, but I can't get mvn install to work for child modules that are more than 1 level deep when one of the child modules depends on another child module. For example, consider this hierarchy:
└── root (pom type)
└── child (pom type)
├── child-1 (jar type)
└── child-2 (jar type; depends on child-1)
With the configuration described in the maven docs, I can run mvn install successfully from all directories except child-2. In child-2, I get this error:
[ERROR] Failed to execute goal on project child-2: Could not resolve dependencies for project com.mygroup:child-2:maven-archetype:local: Failed to collect dependencies at com.mygroup:child-1:jar:local: Failed to read artifact descriptor for com.mygroup:child-1:jar:local: com.mygroup:root:pom:${revision} was not found in https://maven-central.storage-download.googleapis.com/maven2/ during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]

How does maven decide when to use the target folder for classpath

I have a question regarding how maven calculates the classpath during building. Specifically, what controls when the "target/classes" is used and when the "jar" from a repository (local/remote) is used.
I have a project on version 1.0.0-SNAPSHOT where the artifacts have NOT been installed/deployed so there is no "jar" in some repository (remote or local) to resolve them. I want to run "generate-sources" WITHOUT installing locally (no 'mvn install' run).
The structure looks like this:
parent-prj
parent-prj/sub-prj
parent-prj/gen-src-prj <--- This depends on 'sub-prj'
When I run "mvn -am -pl parent-prj/gen-src-prj generate-sources" in order to just generate some java files, it does not work:
[ERROR] Failed to execute goal on project gen-src-prj: Could
not resolve dependencies for project
mygrp:gen-src-prj:jar:1.0.0-SNAPSHOT:
Could not find artifact
mygrp:sub-prj:jar:1.0.0-SNAPSHOT -> [Help 1]
Using debug output and adding "dependency:build-classpath" I can confirm that maven ignores the presence of "sub-prj" in the reactor and looks for a "jar" somewhere which it can't find. Yet the project is printed in the reactor summary:
[INFO] Reactor Summary:
[INFO]
[INFO] parent-prj ..................................... SUCCESS [ 0.625 s]
[INFO] sub-prj ........................................ SUCCESS [ 0.018 s]
[INFO] gen-src-prj .................................... FAILURE [ 0.040 s]
The interesting thing I noticed is that running the compile goal works fine! This uses sub-prj/target/classes (as shown by dependency:build-classpath) and has no trouble generating the sources and even compiling them: "mvn -am -pl parent-prj/gen-src-prj compile"
So here are the points I want to understand:
Why does the compile goal work but the generate-sources doesn't work?
At what point does maven decide to use the output folder of previous projects on the reactor classpath instead of looking for a jar?
Is there a way for generate-sources to run directly as I want it EVEN WITHOUT having its dependencies resolved?
Regarding (3) my generation tool is a utility invoked by:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
The tool reads some XML in src/main/resources and generates Java files and does NOT need anything in its class-path (so there is no need for maven to resolve it).
Also note that I would be interested to understand (1) and (2) even if a solution for (3) is provided.
EDIT: Per comment request, adding full example
parent-prj/pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>mygrp</groupId>
<artifactId>parent-prj</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>sub-prj</module>
<module>gen-src-prj</module>
</modules>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.9</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
parent-prj/sub-prj/pom.xml
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>mygrp</groupId>
<artifactId>parent-prj</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>sub-prj</artifactId>
</project>
parent-prj/gen-src-prj/pom.xml
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>mygrp</groupId>
<artifactId>parent-prj</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>gen-src-prj</artifactId>
<dependencies>
<dependency>
<groupId>mygrp</groupId>
<artifactId>sub-prj</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<includeProjectDependencies>false</includeProjectDependencies>
<includePluginDependencies>true</includePluginDependencies>
<mainClass>uk.co.real_logic.sbe.SbeTool</mainClass>
<systemProperties>
<systemProperty>
<key>sbe.output.dir</key>
<value>${project.build.directory}/generated-sources/java</value>
</systemProperty>
<systemProperty>
<key>sbe.validation.warnings.fatal</key>
<value>true</value>
</systemProperty>
</systemProperties>
<arguments>
<argument>${project.build.resources[0].directory}/Examples.xml</argument>
</arguments>
<workingDirectory>${project.build.directory}/generated-sources/java</workingDirectory>
</configuration>
<dependencies>
<dependency>
<groupId>uk.co.real-logic</groupId>
<artifactId>sbe-tool</artifactId>
<version>1.7.10</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>target/generated-sources/java/</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
EDIT: Armed with the knowledge from the answers I have come up with this workaround that allows one to achieve the desired behaviour. I list the dependencies in a profile that is active by default, then use another profile to run generate-sources with no dependencies active, like follows:
parent-prj/gen-src-prj/pom.xml
<profiles>
<profile>
<id>default</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<dependencies>
<dependency>
<groupId>mygrp</groupId>
<artifactId>sub-prj</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>excludeDependency</id>
<dependencies>
</dependencies>
</profile>
</profiles>
To generate sources with above, use: mvn -PexcludeDependency generate-sources
Maven can reference only output generated in current Session (during currently executing shell command). It uses the most "mature" place to look for the "output":
If compile is run - the classes end up in the target/classes dir, thus other modules can reference that
If package is run - then target/*.jar is created and this jar file ends up in the classpath instead
If install is run - then jar file ends up in the local repository - which is what ends up on the classpath
So there are 3 factors that impede your task:
maven-exec-plugin requires dependency resolution (as pointed out by #mondaka)
Your module1 references module2
generate-sources is run before the compilation. Thus module2 is not yet prepared to be used as a dependency.
So if you want to do it your way - you'll have to run at least compile phase each time you use anything from the Default Lifecycle. Or you could write your own plugin that doesn't require dependency resolution.
This problem is related to an open maven bug:
https://issues.apache.org/jira/browse/MNG-3283
The issue says: "The problem only occurs when a plugin binds itself to the
generate-sources phase and has #requiresDependencyResolution".
I have checked that exec-maven-plugin Mojo have indeed requiresDependencyResolution = ResolutionScope.TEST. You can see that on https://github.com/mojohaus/exec-maven-plugin/blob/master/src/main/java/org/codehaus/mojo/exec/ExecJavaMojo.java
Then, your only option is to use compile or process-classes phases. This is a Major open bug from 2007...

Kotlin Multi-module Project Dependency is Unresolved in test Lifecycle

Project structure:
Pure Kotlin as multi module maven application
kotlinspringboot (root-module)
api
integration-tests
Problem:
When I run
$ cd ./kotlingspringboot/integration-tests/
$ mvn test
or
$ cd ./kotlingspringboot/integration-tests/
$ mvn kotlin:test-compile
I get following compilation error regarding unresolved reference for a class from api module :
[ERROR] Failed to execute goal org.jetbrains.kotlin:kotlin-maven-plugin:1.2.21:test-compile (test-compile) on project hello-integration-tests: Compilation failure: Compilation failure:
[ERROR] C:\workspace\kotlinspringboot\integration-tests\src\test\kotlin\org\ildar\hello\integration\HelloEndpointTests.kt:[6,18] Unresolved reference: SpringKotlinHelloWorldApplication
Note: I've ran previously mvn clean install and verified that .m2 cache contains valid api module jar.
api (sub-module) pom.xml
....
<parent>
<artifactId>kotlin-spring-boot</artifactId>
<groupId>org.ildar</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>hello-api</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
....
integration-tests (sub-module) pom.xml
<parent>
<artifactId>kotlin-spring-boot</artifactId>
<groupId>org.ildar</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>hello-integration-tests</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<testSourceDirectory>${project.basedir}/src/test/kotlin</testSourceDirectory>
<plugins>
<plugin>
<artifactId>kotlin-maven-plugin</artifactId>
<groupId>org.jetbrains.kotlin</groupId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>compile</id>
<goals> <goal>compile</goal> </goals>
</execution>
<execution>
<id>test-compile</id>
<goals> <goal>test-compile</goal> </goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Link to a project on github :
https://github.com/IldarGalikov/kotlinspringboot
Since Spring removed the "MODULE" Layout in Spring Boot 2.0, maven was complaining about a non existent LayoutType ENUM when trying Christophs answer.
Looking at the Docs though helped me resolve the issue: https://docs.spring.io/spring-boot/docs/current/maven-plugin/examples/repackage-classifier.html
Specifically adding this to the spring-boot-maven-plugin:
<executions>
<execution>
<id>repackage</id>
<configuration>
<classifier>exec</classifier>
</configuration>
</execution>
</executions>
The problem is caused by Spring Boot's repackaging of the API jar. It moves the class files of your application from the root of the jar into a BOOT-INF/classes folder in the jar. When compiling the integration tests the kotlin compiler only search the root of the jar for class files and does not look into the BOOT-INF folder. As a result it cannot resolve references to the classes in the API jar.
This answer by Damien describes how to make Spring Boot keeping your application classes in the root of the jar. If I add the configuration mentioned there to your api/pom.xml the integration tests in your project compile as expected:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<layout>MODULE</layout>
</configuration>
</plugin>

MulitModule project dependency management

I am working on the project with the project structure as
root
lib
xyz.jar
modules
module1
module2
Now I want to include the xyz.jar in the module1 but owing to the multimodule structure of the project, I am not able to add the jar directly through maven.
I tried using
<plugin>
<groupId>org.commonjava.maven.plugins</groupId>
<artifactId>directory-maven-plugin</artifactId>
<version>0.1</version>
<executions>
<execution>
<id>directories</id>
<goals>
<goal>highest-basedir</goal>
</goals>
<phase>initialize</phase>
<configuration>
<property>multi.module.project.root.dir</property>
</configuration>
</execution>
</executions>
</plugin>
and then using
<dependency>
<groupId>org.abc.com</groupId>
<artifactId>xyz</artifactId>
<version>0.1.0</version>
<scope>system</scope>
<systemPath>${multi.module.project.root.dir}/lib/xyz.jar</systemPath>
</dependency>
but throws error to specify absolute path of jar.
next I tried using the de
pendency management in parent pom by specifying
<dependency>
<groupId>org.abc.com</groupId>
<artifactId>xyz</artifactId>
<version>0.1.0</version>
<scope>system</scope>
<systemPath>${pom.basedir}/lib/xyz.jar</systemPath>
</dependency>
This resolves the dependency but I am not able to use the dependency in the child pom of module1
How can I solve this
The documentation of the directory-maven-plugin you are using explicitly says about the variables produced by the plugin:
They will be useful ONLY IN PLUGIN CONFIGURATIONS, NOT DURING POM INTERPOLATION.
This means you cannot use it like what you are doing.
As an alternative, I would consider referring to this SO answer.

Maven - why maven won't download the dependency pom in addition to the jar file

I have a Maven project. One of my dependencies is a zip file. Maven downloads this zip file to the local repository but the pom file is not there too. How can I instruct Maven to download also the pom file? the type of my dependency is zip.
the pom file exists in the remote repository.
the pom file:
<modelVersion>4.0.0</modelVersion>
<groupId>com.g.g</groupId>
<artifactId>art</artifactId>
<name>art</name>
<version>1-SNAPSHOT</version>
<packaging>pom</packaging>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>createZip.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
the deploy command:
call mvn clean install
call mvn deploy:deploy-file -Durl=url -Dpackaging=zip -Dfile="%~dp0\target\art-1-SNAPSHOT.zip" -DgroupId=com.g.g -DartifactId=art -Dversion=1-SNAPSHOT -DrepositoryId=... -DpomFile="pom.xml"
the dependency:
<dependency>
<groupId>com.g.g</groupId>
<artifactId>art</artifactId>
<version>1-SNAPSHOT</version>
<type>zip</type>
If you want both the zip and the pom, you may specify them both as dependencies.
<dependency>
<groupId>com.g.g</groupId>
<artifactId>art</artifactId>
<version>1-SNAPSHOT</version>
<type>zip</type>
<dependency>
<groupId>com.g.g</groupId>
<artifactId>art</artifactId>
<version>1-SNAPSHOT</version>
<type>pom</type>
Another way to do it if you don't want to specify the pom as a dependency: the Maven dependency plugin has a get mojo that allows downloading of named artifacts from a remote repository.
This could be because the packaging in the pom.xml differs from the packaging of the dependency. While pom.xml has the packaging as pom, the actual dependency packaging is zip.
Try changing the <packaging> in pom.xml to zip and see if addresses the issue.

Resources