简体   繁体   中英

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM