0
votes

In my project I have couple of files that I pack into a ZIP file and upload it to a Nexus repository.

I implemented both actions using Maven assembly plugin:

POM.XML

<groupId>com.ddd.tools</groupId>
<artifactId>mytool</artifactId>
<version>2.1.0</version>
<packaging>pom</packaging>

<name>Tool</name>
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>2.4</version>
            <configuration>
                <!-- File bin.xml saves information about which files are to be included to the ZIP archive. -->
                <descriptor>bin.xml</descriptor>
                <finalName>${pom.artifactId}-${pom.version}</finalName>
            </configuration>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

BIN.XML

<assembly ...>
    <id>bin</id>
    <formats>
        <format>zip</format>
    </formats>
    <fileSets>
        <fileSet>
            <directory>src/release</directory>
            <outputDirectory>/</outputDirectory>
            <includes>
                <include>Tool.exe</include>
            </includes>
        </fileSet>
    </fileSets>
</assembly>

Now, when I look in Nexus I see TWO artifacts:

    <dependency>
      <groupId>com.ddd.tools</groupId>
      <artifactId>mytool</artifactId>
      <version>2.1.0</version>
      <type>pom</type>
    </dependency>

and

<dependency>
  <groupId>com.ddd.tools</groupId>
  <artifactId>mytool</artifactId>
  <version>2.1.0</version>
  <classifier>bin</classifier>
  <type>zip</type>
</dependency>

I'm only interested in the latter ZIP artifact because it is the ZIP file I uploaded.

How can I get rid of the first POM artifact from Nexus? Or is there any scenario where I could need it?

1
First the finalName configuration in your pom is useless for the upload into Nexus. And you can't prevent the pom artifact, cause it's neccessary. And yes all times you are using this kind of dependency the pom artifact is used to identify the artifact. You pasted snippets are only for usage as dependency but they need the pom artifact which is needed to analyze what kind of artifact this is and if it has other dependencies..(not in this case).khmarbaise

1 Answers

0
votes

I believe what you want to do is possible when using raw repos in Nexus 3. AFAIK, the pom is required for an actual artifact upload, per khmarbaise