0

On the internets there is quite a lot of conflicting information on how/if binaries can be deployed to Maven Central. As I would like to avoid hiding them inside the JAR, I have found the guide which suggests using the POM target and then the codehaus plugin in order to deploy the required binary:

<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>
    <packaging>pom</packaging>
    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>1.8</version>
                <executions>
                    <execution>
                        <id>attach-artifacts</id>
                        <phase>package</phase>
                        <goals>
                            <goal>attach-artifact</goal>
                        </goals>
                        <configuration>
                            <artifacts>
                                <artifact>
                                    <file>mybinary.so</file>
                                    <type>so</type>
                                </artifact>
                            </artifacts>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

I use the following ANT task to upload the binary:

<target name="stage" depends="" description="deploy release version to Maven staging repository">
    <artifact:mvn>
        <arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
        <arg value="-Durl=${ossrh-staging-repository-url}" />
        <arg value="-DrepositoryId=${ossrh-server-id}" />
        <arg value="-DpomFile=pom.xml" />
        <arg value="-Dfile=mybinary.so" />
        <arg value="-Pgpg" />
    </artifact:mvn>
</target>

When I run the task, I can see my binary uploading and the SUCCESS return message, but when I log in and check the OSS control panel, my upload only contains the POM file.

Any clues? Any success stories? And finally why is this so difficult, to me Ivy was already too complicated after pypi, but Maven seems oh-so-much-worse.

George Karpenkov
  • 2,094
  • 1
  • 16
  • 36
  • The final reference is here: http://central.sonatype.org/pages/requirements.html What i don't understand why are you using ant to deploy artifacts instead of Maven and attaching artifacts via Maven which would make this much more simpler... – khmarbaise Feb 21 '16 at 12:42
  • Hi @khmarbaise, of course I have read the final reference. There is nothing there about deploying binary artifacts though. Do you have a working example in Maven? – George Karpenkov Feb 21 '16 at 16:55

0 Answers0