0

I have a sample application with a build.gradle as below. I'm trying to convert it to maven

I'm new to gradle and maven, but have slightly more knowledge of maven, so want to stick with it for now.

I read some instructions as https://dzone.com/articles/how-to-convert-maven-to-gradle-and-vice-versa

I put the "apply plugin maven" line in to get a pom file generated as per the instructions. When I run gradlew install I get the following error

Execution failed for task ':install'.

Could not publish configuration 'archives' Cannot publish artifact 'hello-world-java.jar' (C:\Users\xxx\IdeaProjects\HelloWorld-Java\build\libs\hello-world-java-0.1.0.jar) as it does not exist.

I've previously been working fine with this project (running it from InteliJ IDEA). I've also previously successfully converted another project (console based) to maven.

I've also seen https://docs.gradle.org/current/userguide/publishing_overview.html#sec:configuring_publishing_tasks However I don't actually want to publish the archive, i just want the equiveelent pom.xml. I notice that the install task doesn't exist if i dont have the maven plugin. I also tried just doing gradlew compile, but it didn't generate the pom.xml. I guess i need to read more about the mavin plugin

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:2.1.0.RELEASE")
    }
}

apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

bootJar{
    mainClassName = 'com.intuit.developer.helloworld.Application'
}



jar {
    archiveBaseName = 'hello-world-java'
    archiveVersion =  '0.1.0'

}

repositories {
    mavenCentral()
    mavenLocal()
}

sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies {
    compile("com.intuit.quickbooks-online:ipp-v3-java-data:4.0.1")
    compile (group: 'com.intuit.quickbooks-online', name: 'ipp-v3-java-devkit', version: '4.0.1', classifier: 'jar-with-dependencies')   
    compile (group: 'com.intuit.quickbooks-online', name: 'oauth2-platform-api', version: '4.0.1', classifier: 'jar-with-dependencies')   
    compile("org.springframework.boot:spring-boot-starter-web")
    compile("org.springframework.boot:spring-boot-starter-thymeleaf")
    compile("org.springframework.data:spring-data-rest-webmvc")
    compile("org.json:json")
    compile("log4j:log4j:1.2.17")
    compile (group: 'ant', name: 'ant', version: '1.7.0')
    testCompile('org.springframework.boot:spring-boot-starter-test')

}

wrapper {
    gradleVersion = '2.3'
}
Martin Alley
  • 121
  • 1
  • 9

1 Answers1

1

The Maven POM generated by a Gradle build only contains the information needed for consumers of the project: dependencies. The POM will have no configuration about building the library itself using Maven, like plugins and other things.

Louis Jacomet
  • 13,661
  • 2
  • 34
  • 43