Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update p2AsMaven docs for multi-project usage in Gradle 6+ #119

Closed
drkstr101 opened this issue Feb 5, 2020 · 8 comments
Closed

Update p2AsMaven docs for multi-project usage in Gradle 6+ #119

drkstr101 opened this issue Feb 5, 2020 · 8 comments

Comments

@drkstr101
Copy link

Hello,

I just wanted to inform you that the p2AsMaven task does not appear to work in Gradle versions greater than 5.6.4.

Here is an example build that works in 5.6.4 but not 6.0.

enm.model/build.gradle

plugins {
    // Apply the java-library plugin to add support for Java Library
    id 'java-library'
}

// we need the maven repo from p2
evaluationDependsOn(':enm.model.p2')

repositories {
    jcenter()
    mavenCentral()
    maven {
        url project(':enm.model.p2').file('build/p2asmaven/maven')
    }
}

dependencies {

    api 'eclipse-deps:org.eclipse.emf.ecore:+',
            'eclipse-deps:org.eclipse.emf.common:+',
            'eclipse-deps:org.eclipse.emf.ecore.xmi:+',
            'eclipse-deps:org.eclipse.core.runtime:+'
}

enm.model.p2/build.gradle

apply plugin: 'com.diffplug.gradle.p2.asmaven'

p2AsMaven {
    group 'eclipse-deps', {
        repo 'http://download.eclipse.org/releases/2019-12'
        feature 'org.eclipse.platform'
        feature 'org.eclipse.platform.source'
        feature 'org.eclipse.emf.ecore'
        iu 'org.eclipse.emf.ecp.edit'
        iu 'org.eclipse.core.runtime'
        iu 'org.eclipse.emf.edit.ui'
        iu 'org.eclipse.emf.common.ui'
        append true //not required for solution
        repo2runnable()
    }
}

Running the build in 6.0 results in:

Execution failed for task ':enm.model:compileJava'.
> Could not resolve all files for configuration ':enm.model:compileClasspath'.
> Could not find any matches for eclipse-deps:org.eclipse.emf.ecore:+ as no versions of eclipse-deps:org.eclipse.emf.ecore are available.
    Searched in the following locations:
    - https://jcenter.bintray.com/eclipse-deps/org.eclipse.emf.ecore/maven-metadata.xml
    - https://repo.maven.apache.org/maven2/eclipse-deps/org.eclipse.emf.ecore/maven-metadata.xml
    - file:/home/amiller/Workspace/enm/enm-model/enm.model.p2/build/p2asmaven/maven/eclipse-deps/org.eclipse.emf.ecore/maven-metadata.xml
    - file:/home/amiller/Workspace/enm/enm-model/enm.model.p2/build/p2asmaven/maven/eclipse-deps/org.eclipse.emf.ecore/2.20.0.v20190920-0401/org.eclipse.emf.ecore-2.20.0.v20190920-0401.pom
    Required by:
        project :enm.model

repeated for each dependency

Note: The repository exists and is valid in both cases. Perhaps gradle 6 has stricter constraints on version matching the dependency?

@nedtwigg
Copy link
Member

nedtwigg commented Feb 5, 2020

What version are you using? Goomph 3.20.0 fixed compat with Gradle 6.

@drkstr101
Copy link
Author

drkstr101 commented Feb 5, 2020

Odd, I am on 3.21.0. I'm investigating further to see if I can narrow down the issue.

@drkstr101
Copy link
Author

My mistake.

The com.diffplug.gradle.p2.asmaven plugin has been deprecated.	 
This is scheduled to be removed in Gradle 6.0.	 
Please use the com.diffplug.p2.asmaven plugin instead.

@drkstr101
Copy link
Author

It still failed after making the change and doing a clean build of the maven repo.

Build scan here: https://gradle.com/s/7qczvv44rxefy

@nedtwigg
Copy link
Member

nedtwigg commented Feb 5, 2020

Aha. It's because you're creating the repo yourself. Goomph does this automatically, but since you're using p2asmaven in its own project (which is perfectly valid), you need to make this change:

maven {
  url project(':enm.model.p2').file('build/p2asmaven/maven')
  metadataSources {
    mavenPom()
    artifact()
  }
}

I think it's common to use p2asmaven this way, so we should probably update the docs to point people to this. Lemme know if this fixes it for you.

@nedtwigg nedtwigg changed the title p2AsMaven fails in Gradle 6.0 Update p2AsMaven docs for multi-project usage in Gradle 6+ Feb 5, 2020
@drkstr101
Copy link
Author

That most certainly did the trick! It now works as expected. Cheers, and thank you for your time!

@nedtwigg
Copy link
Member

Fixed in 3.23.0

@drkstr101
Copy link
Author

Awesome, keep up the great work! IMHO this plugin is a lot more ergonomic than Tycho/Maven builds. I am delighted to have stumbled upon it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants