user1116377
user1116377

Reputation: 699

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>        

Upvotes: 1

Views: 5986

Answers (2)

user944849
user944849

Reputation: 14951

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.

Upvotes: 1

Raghuram
Raghuram

Reputation: 52625

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.

Upvotes: 0

Related Questions