Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8921217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T06:28:59+00:00 2026-06-15T06:28:59+00:00

I am trying to create a gradle build file to deploy a features.xml file

  • 0

I am trying to create a gradle build file to deploy a features.xml file into a local nexus maven repo. I haven’t been able to find any example on how to do this except using maven directly. Anyone have any example of how to do this with gradle? I am attaching the working maven POM as well.

Thanks,
–Christian

<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>company.dept</groupId>
<artifactId>deploy-feature</artifactId>
<packaging>pom</packaging>
<version>1.0</version>
<name>feature.xml</name>
<distributionManagement>
    <repository>
        <id>nexus.repo</id>
        <url>http://nexus:80/nexus/content/repositories/releases/</url>
    </repository>
</distributionManagement>

<build>
    <plugins>
        <plugin>
            <artifactId>maven-resources-plugin</artifactId>
            <version>2.4.3</version>
            <executions>
                <execution>
                    <id>copy-resources</id>
                    <phase>validate</phase>
                    <goals>
                        <goal>copy-resources</goal>
                    </goals>
                    <configuration>
                        <outputDirectory>${basedir}/target</outputDirectory>
                        <resources>
                            <resource>
                                <directory>resources</directory>
                                <filtering>true</filtering>
                            </resource>
                        </resources>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <executions>
                <execution>
                    <id>attach-artifacts</id>
                    <phase>package</phase>
                    <goals>
                        <goal>attach-artifact</goal>
                    </goals>
                    <configuration>
                        <artifacts>
                            <artifact>
                                <file>target/features.xml</file>
                                <type>xml</type>
                                <classifier>features</classifier>
                            </artifact>
                        </artifacts>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T06:29:00+00:00Added an answer on June 15, 2026 at 6:29 am

    Setup locations in gradle.properties

    mavenServer=http://localServer:8042
    mavenRepo=/nexus/content/groups/public
    mavenReleases=/nexus/content/repositories/releases/
    repoUsername=admin
    repoPassword=password
    

    In build.gradle

    apply plugin: 'maven'
    
    repositories {
      maven {
        url = mavenServer+mavenRepo
      }
    }
    
    artifacts {
      archives file('yourxmlfile')
    }
    
    uploadArchives {
      repositories {
        mavenDeployer {
    
          pom.artifactId = 'yourID'
    
          repository(url: mavenServer+mvnReleases) {
            authentication(username:repoUsername, password:repoPassword)
          }
        }
      }
    }
    

    in your settings.xml inside your /.m2/ directory

    <settings xsd="<apache maven xsd>">
    <mirrors>
      <mirror>
        <id>sonatype</id>
        <name>local sonatype nexus</name>
        <url>http://localServer/nexus/content/groups/public</url>
        <mirrorOf>*, !snapshots, !releases</mirrorOf>
      </mirror>
    </mirrors>
    </settings>
    

    this last bit separates your maven mirror from your releasable artifacts

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to implement a gradle task to dynamically create a buildsignature.properties file
I am trying to create a build script using gradle to build a android
I am trying create a xmldocument object by a different XML see the code
I am trying create a table and add this table into tablecell (table inside
I am trying with Gradle first time. I am trying with a maven java
I am trying to set up a gradle build script for a multiproject grails
i've been trying to create a vb6 code that will randomize 10 questions but
I'm trying create simple application in C++. This application has to read from file
I'm creating my first gradle plugin. I'm trying to copy a file from the
I'm trying create a bot which automatically likes Facebook posts. Using Mechanize I can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.