How can you use a dependency from the plugin's dependency scope in the maven-antrun-plugin? - maven

We have a profile that uses maven-antrun-plugin to run a downloaded JAR.
Exhibit A: (this works)
We can reference the downloaded JAR using the property ${maven.dependency.com.foobar.target-jar.jar.path} (Can I use the path to a Maven dependency as a property?). But in this solution, the custom dependency and repository information isn't limited to just the scope of the profile.
<project>
...
<repositories>
<repository>
<id>thirdparty</id>
<name>Third Party</name>
<url>
[URL for the repository that holds the target JAR]
</url>
<layout>default</layout>
</repository>
</repositories>
...
<dependencies>
<dependency>
<groupId>com.foobar</groupId>
<artifactId>target-jar</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
...
<profiles>
<profile>
<id>runJARprofile</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<inherited>false</inherited>
<executions>
<execution>
<id>run-jar</id>
<phase>package</phase>
<configuration>
<target name="runJar" fork="true">
<java jar="${maven.dependency.com.foobar.target-jar.jar.path}" />
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
...
</project>
Exhibit B: (haven't gotten it working)
Here, we moved the dependency and repository information into the profile. Maven downloads the artifact successfully, but we no longer know how to reference it by property.
<project>
...
<profiles>
<profile>
<pluginRepositories>
<repository>
<id>thirdparty</id>
<name>Third Party</name>
<url>
[URL for the repository that holds the target JAR]
</url>
<layout>default</layout>
</repository>
</pluginRepositories>
...
<id>runJARprofile</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<inherited>false</inherited>
<dependencies>
<dependency>
<groupId>com.foobar</groupId>
<artifactId>target-jar</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>run-jar</id>
<phase>package</phase>
<configuration>
<target name="runJar" fork="true">
<java jar="${?????}" />
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
...
</project>

I crated a POM similar to your Exhibit B here and got the following message during a mvn package -P runJARprofile:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.8:run
(run-jar) on project so-36848518: An Ant BuildException has occured:
Cannot execute a jar in non-forked mode. Please set fork='true'.
[ERROR] around Ant part ...<java jar="${my:test:jar}"/>...
I changed the respective line to:
<java jar="${my:test:jar} fork="true"/>
and:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------

Related

Failed to execute goal org.apache.maven.plugins:maven-gpg-plugin:1.5:sign (sign-artifacts) on project playerinputs: Exit code: 1 -> [Help 1]

I was trying to upload my first api to the maven central but I continue getting this error. I haven't been able to solve it. I am running mvn clean deploy
I have read that running mvn clean deploy -Dgpg.skip=true could work but it doesn't. I also have read this threads: stackoverflow github but it doesn't work
Here is the error
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.411 s
[INFO] Finished at: 2020-06-07T14:15:53+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-gpg-plugin:1.5:sign (sign-artifacts) on project playerinputs: Exit code: 1 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
I have checked the page that is linked in the error but I coudn't love it
Here is my 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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.MrNemo64</groupId>
<artifactId>playerinputs</artifactId>
<version>1.2</version>
<name>PlayerInputs</name>
<description>Useful clases to get player inputs in several ways</description>
<url>https://github.com/MrNemo64/player-inputs</url>
<licenses>
<license>
<name>MIT License</name>
<url>http://www.opensource.org/licenses/mit-license.php</url>
</license>
</licenses>
<developers>
<developer>
<name>Javier Rodríguez Pérez</name>
<email>my.nemo_64.otravez#gmail.com</email>
<organization>org.github.MrNemo64</organization>
<organizationUrl>https://github.com/MrNemo64/player-inputs</organizationUrl>
</developer>
</developers>
<scm>
<connection>scm:git:git://github.com/MrNemo64/player-inputs.git</connection>
<developerConnection>scm:git:ssh://github.com:MrNemo64/player-inputs.git</developerConnection>
<url>https://github.com/MrNemo64/player-inputs</url>
</scm>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.7</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
<!-- This adds the Spigot Maven repository to the build -->
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
<dependencies>
<!--This adds the Bukkit API artifact to the build -->
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.13.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>3.0.2</version>
</dependency>
</dependencies>
</project>
Tell me if you need more information and thanks for the help!
In some cases if you are using gpg plugin to sign your artifacts you might get the following error and the build will fail.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-gpg-plugin:1.5:sign (sign-artifacts) on project testng-parser: Exit code: 2
If you get the above error there are few ways to skip artifact signing and carryout your build.
Method 1 : Editing your POM
You can disable the gbp plugin from the POM or skip the signing of artifacts. Refer the following.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
Method 2 : Disabling at runtime
You can also disable gpg signing at runtime by running the mvn build with following parameter.
mvn clean install -Dgpg.skip
Or as
mvn clean install -Dgpg.skip=true

Maven release: Developer information missing

Getting this error on mvn release:perform
[ERROR] Repository "comconvertapi-1002" failures
[ERROR] Rule "pom-staging" failures
[ERROR] * Invalid POM: /com/convertapi/client/convertapi/1.7/convertapi-1.7.pom: Developer information missing
Releasing from branch: https://github.com/ConvertAPI/convertapi-java/tree/feature/maven (could this error be related with that?)
This is POM file:
<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>com.convertapi.client</groupId>
<artifactId>convertapi</artifactId>
<packaging>jar</packaging>
<version>1.8-SNAPSHOT</version>
<name>ConvertAPI Java Client</name>
<description>
The ConvertAPI helps converting various file formats.
Creating PDF and Images from various sources like Word, Excel, Powerpoint, images, web pages or raw HTML codes.
Merge, Encrypt, Split, Repair and Decrypt PDF files.
And many others files manipulations.
In just few minutes you can integrate it into your application and use it easily.
The ConvertAPI client library makes it easier to use the Convert API from your Java 8 projects without having to
build your own API calls.
</description>
<url>https://www.convertapi.com/</url>
<licenses>
<license>
<name>The MIT License</name>
<url>https://raw.githubusercontent.com/ConvertAPI/convertapi-java/master/LICENSE.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<developers>
<developer>
<id>jonas</id>
<name>Jonas Jasas</name>
<email>jonas#baltsoft.com</email>
<organization>Baltsoft</organization>
<organizationUrl>http://www.baltsoft.com/</organizationUrl>
<roles>
<role>architect</role>
<role>developer</role>
</roles>
<timezone>+3</timezone>
<properties>
<picUrl>https://avatars3.githubusercontent.com/u/16254748</picUrl>
</properties>
</developer>
</developers>
<scm>
<connection>scm:git:git://github.com/ConvertAPI/convertapi-java.git</connection>
<developerConnection>scm:git:git://github.com/ConvertAPI/convertapi-java.git</developerConnection>
<url>https://github.com/ConvertAPI/convertapi-java</url>
<tag>HEAD</tag>
</scm>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.5</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>3.10.0</version>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<excludes>
<exclude>**/examples/*</exclude>
</excludes>
<filtering>false</filtering>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
<executions>
<execution>
<id>default-deploy</id>
<phase>deploy</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
<configuration>
<localCheckout>true</localCheckout>
<pushChanges>false</pushChanges>
<mavenExecutorId>forked-path</mavenExecutorId>
<arguments>-Dgpg.passphrase=${gpg.passphrase}</arguments>
</configuration>
<dependencies>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-gitexe</artifactId>
<version>1.9.5</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.7</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<!-- GPG Signature on release -->
<profile>
<id>release-sign-artifacts</id>
<activation>
<property>
<name>performRelease</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
It's seem ok, but sometime maven plugins use cache for some info.
Try to clear cache by this sequence of commands:
mvn clean
mvn release:prepare -Dresume=false
mvn release:perform
If it not helped, try to simplify developer section (excluding sequentially properties, timezone and so on)
Publish Requirement
Please check you have fulfill all your publish requirement.
Supply Javadoc and Sources⚓︎
Sign Files with GPG/PGP
Sufficient Metadata
Correct Coordinates
Project Name, Description and URL
License Information
Developer Information
SCM Information

Vaadin custom client side widget cannot compile 'No plugin found for prefix 'vaadin''

I trying to create a custom client side widget with eclipse IDE. when i click compile widgetset option from the toolbar it stops with following error. This topic is a duplicate, but no suitable answer.
[INFO] Scanning for projects...
[INFO] Downloading:
https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-
metadata.xml
[INFO] Downloading:
https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml
[INFO] Downloaded:
https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-
metadata.xml (13 KB at 6.2 KB/sec)
[INFO] Downloaded:
https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml
(20 KB at 8.4 KB/sec)
[INFO] ---------------------------------------------------------------------
---
[INFO] BUILD FAILURE
[INFO] ---------------------------------------------------------------------
---
[INFO] Total time: 5.004 s
[INFO] Finished at: 2017-07-04T15:48:53+05:30
[INFO] Final Memory: 15M/143M
[INFO] ---------------------------------------------------------------------
---
[ERROR] No plugin found for prefix 'vaadin' in the current project and in
the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available
from the repositories [local (C:\Users\xxxx\.m2\repository), central
(https://repo.maven.apache.org/maven2)] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e
switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please
read the following articles:
[ERROR] [Help 1]
My 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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>logicalintelligence.widget.navigationdrawer</groupId>
<artifactId>navigationdrawer</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>Navigationdrawer Add-on</name>
<prerequisites>
<maven>3</maven>
</prerequisites>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<vaadin.version>7.7.10</vaadin.version>
<vaadin.plugin.version>7.7.10</vaadin.plugin.version>
<!-- ZIP Manifest fields -->
<Implementation-Version>${project.version}</Implementation-Version>
<!-- Must not change this because of the Directory -->
<Implementation-Title>${project.name}</Implementation-Title>
<Implementation-Vendor>${project.organization.name}</Implementation-Vendor>
<Vaadin-License-Title>Apache License 2.0</Vaadin-License-Title>
<Vaadin-Addon>${project.artifactId}-${project.version}.jar</Vaadin-Addon>
</properties>
<licenses>
<license>
<name>Apache 2</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<repositories>
<repository>
<id>vaadin-addons</id>
<url>http://maven.vaadin.com/vaadin-addons</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-server</artifactId>
<version>${vaadin.version}</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client</artifactId>
<version>${vaadin.version}</version>
<scope>provided</scope>
</dependency>
<!-- This can be replaced with TestNG or some other test framework supported by the surefire plugin -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
<configuration>
<archive>
<index>true</index>
<manifest>
<addClasspath>true</addClasspath>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
<manifestEntries>
<!-- Package format version - do not change -->
<Vaadin-Package-Version>1</Vaadin-Package-Version>
<Vaadin-License-Title>${Vaadin-License-Title}</Vaadin-License-Title>
<Vaadin-Widgetsets>logicalintelligence.widget.navigationdrawer.navigationdrawer.WidgetSet</Vaadin-Widgetsets>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.3</version>
<executions>
<execution>
<id>attach-javadoc</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>assembly/assembly.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<goals>
<goal>single</goal>
</goals>
<phase>install</phase>
</execution>
</executions>
</plugin>
<!-- Testing -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
</plugin>
</plugins>
<!-- This is needed for the sources required by the client-side compiler to be
included in the produced JARs -->
<resources>
<resource>
<directory>src/main/java</directory>
<excludes>
<exclude>rebel.xml</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
</build>
<profiles>
<profile>
<!-- Vaadin pre-release repositories -->
<id>vaadin-prerelease</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<repositories>
<repository>
<id>vaadin-prereleases</id>
<url>http://maven.vaadin.com/vaadin-prereleases</url>
</repository>
<repository>
<id>vaadin-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>vaadin-prereleases</id>
<url>http://maven.vaadin.com/vaadin-prereleases</url>
</pluginRepository>
<pluginRepository>
<id>vaadin-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
</project>
Yes Morfic is right, I solved the problem by adding followings to the pom.xml
<plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<version>${vaadin.plugin.version}</version>
<executions>
<execution>
<goals>
<goal>update-theme</goal>
<goal>update-widgetset</goal>
<goal>compile</goal>
<!-- Comment out compile-theme goal to use on-the-fly theme compilation -->
<goal>compile-theme</goal>
</goals>
</execution>
</executions>
</plugin>

mvn release:perform distributionManagement url

I have this configuration in my pom.xml:
<distributionManagement>
<downloadUrl>http://mydomain/downloads/<downloadUrl>
<repository>
<id>Id</id>
<name>Name</name>
<url>scp://ipaddress/downloads/</url>
</repository>
</distributionManagement>
When I do mvn release:perform and navigate to http://mydomain/downloads/, there is a directory hierarchy com/my/application that is my app groupId and, inside that, I have the .apk file (is an Android app).
Is there any way to deploy the apk in http://mydomain/downloads/ instead of http://mydomain/downloads/com/my/application ? I mean, ignore the groupId.
Thanks!
You can't ignore the groupId cause this is the foundation on which a maven repository is based.
If you like to do it in an other way than you shouldn't use deployment of Maven. The solution can be to use a particular plugin like wagon-maven-plugin
Thanks to khmarbaise, I found the solution using wagon plugin:
<build>
...
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh</artifactId>
<version>2.8</version>
</extension>
</extensions>
...
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>wagon-maven-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<id>upload-apk</id>
<phase>deploy</phase>
<goals>
<goal>upload</goal>
</goals>
<configuration>
<fromDir>${project.build.directory}</fromDir>
<includes>${project.build.finalName}.apk</includes>
<url>scp://ipaddress/downloads/${artifactId}</url>
<serverId>downloads</serverId>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Furthermore, I put <serverId> tag beacuse its credentials are stored in settings.xml.

Building an RPM containing JDK dependency resolution

I'm building oracle jdk 1.6 into an rpm using maven and nexus from a zip file distribution of the jdk.
When done, the rpm refuses to install without the following:
[root#build]# rpm -ivh oracle-jdk-1.6.0_26-1.noarch.rpm
error: Failed dependencies:
libXt.so.6()(64bit) is needed by oracle-jdk-1.6.0_26-1.noarch
libodbc.so()(64bit) is needed by oracle-jdk-1.6.0_26-1.noarch
libodbcinst.so()(64bit) is needed by oracle-jdk-1.6.0_26-1.noarch
Fine. I'm guessing maven created this dependency. The jdk in it's native unzipped form works fine.
How can I configure my pom so that maven will not resolve these dependencies?
How would I configure my pom so that yum -y install will install the missing libraries?
I ask both, as I'm not sure which way I will sway.
Edit: my pom:
<?xml version="1.0"?>
<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>com.oracle</groupId>
<artifactId>jdk</artifactId>
<version>1.6.0_26</version>
<packaging>pom</packaging>
<properties>
<unix.user>root</unix.user>
<rpm.friendly.name>oracle-jdk</rpm.friendly.name>
<rpm.install.basedir>/usr/java/jdk/1.6.0_26</rpm.install.basedir>
<sourcefile.unzip.dir>${project.build.directory}/jdk1.6.0_26</sourcefile.unzip.dir>
<yum.repo.host>localhost</yum.repo.host>
<yum.repo.path>/apps/httpd/yumrepo</yum.repo.path>
</properties>
<dependencies>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>jdk</artifactId>
<version>1.6.0_26</version>
<type>tar.gz</type>
</dependency>
</dependencies>
<distributionManagement>
<repository>
<id>ssh-repository</id>
<url>scpexe://${yum.repo.host}${yum.repo.path}</url>
</repository>
</distributionManagement>
<build>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh-external</artifactId>
<version>1.0-beta-6</version>
</extension>
</extensions>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rpm-maven-plugin</artifactId>
<version>2.1-alpha-3</version>
<executions>
<execution>
<id>generate-rpm</id>
<goals>
<goal>attached-rpm</goal>
</goals>
</execution>
</executions>
<configuration>
<name>${rpm.friendly.name}</name>
<copyright>2014, JM</copyright>
<group>Application/Internet</group>
<packager>JM</packager>
<needarch>false</needarch>
<changelogFile>src/changelog</changelogFile>
<mappings>
<mapping>
<directory>${rpm.install.basedir}</directory>
<username>${unix.user}</username>
<groupname>${unix.user}</groupname>
<sources>
<source>
<location>${sourcefile.unzip.dir}</location>
</source>
</sources>
</mapping>
</mappings>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>unpack</id>
<phase>generate-resources</phase>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>thirdparty</id>
<url>http://myrepo.com:8081/nexus/content/repositories/thirdparty</url>
</repository>
</repositories>
</project>
Basically i think its not a good idea to include other binaries (like java) in your package
i'd rather have dependency on them.
But sometimes you have to, for example customer already have Java on his machine but you want to run your own java version and thus provide it with your package.
To do that you can simply tell the maven plugin not to automatically add requires to those packages.
like this
<configuration>
......
<autoRequires>false</autoRequires>
</configuration>

Resources