eclipseguru / missing-swt-fragments

Dummy fragments for SWT missing in Eclipse Neon
Eclipse Public License 1.0
2 stars 3 forks source link

Can I use this in my gradle build (via jitpack?) somehow? #3

Open stefanhaustein opened 7 years ago

stefanhaustein commented 7 years ago

Any suggestions for using this in a gradle (or maven) build? Does this make any sense at all?

What I have tried:

apply plugin: 'java'

repositories {
     mavenCentral()
     maven {
         url 'https://jitpack.io' 
     }
}

dependencies {
    compile "org.eclipse.platform:org.eclipse.swt:3.105.2"
    compile "com.github.eclipseguru:missing-swt-fragments:master-SNAPSHOT"

    testCompile 'junit:junit:4.12'
}

See https://github.com/stefanhaustein/swtavd/blob/master/build.gradle

guw commented 7 years ago

Sorry, I have now idea how a Gradle build would consume a p2 repository. It's not a Maven repository. If you want to use it in a Maven build you have to use Maven Tycho.

stefanhaustein commented 7 years ago

I guess I was confused by the presence of a pom file...

I have tried building with a gradle p2 dependency resolver, but it fails with

Cannot fetchVersions for org.eclipse.swt.gtk.linux.aarch64 in http://eclipseguru.github.io/missing-swt-fragments

I am not sure how Tycho could help, as my problem seems to be the other way around: I just want to build a library depending on SWT with gradle (maven would be fine, too).

guw commented 7 years ago

Thanks for the link. This is helpful. It says that it does not support composite repositories, which the main repository is. That's probably why you get the error message.

Depending on what version of Neon you are using, can you try one of the following URLs?

stefanhaustein commented 7 years ago

For any of those urls, I get "Server returned lastModified <= 0 for https://eclipseguru.github.io/missing-swt-fragments/neon.1/artifacts.jar"

guw commented 7 years ago

That could be network issues or an odd proxy in the middle. Can you access and download from a browser?

FWIW, here is what I get:

$ curl -s -D - https://eclipseguru.github.io/missing-swt-fragments/neon.1/artifacts.jar -o /dev/null
HTTP/1.1 200 OK
Server: GitHub.com
Content-Type: application/java-archive
Last-Modified: Fri, 24 Mar 2017 16:20:47 GMT
Access-Control-Allow-Origin: *
Expires: Sun, 26 Mar 2017 16:58:24 GMT
Cache-Control: max-age=600
X-GitHub-Request-Id: 525A:7CB4:2F4FDB5:3F0C617:58D7F0D8
Content-Length: 852
Accept-Ranges: bytes
Date: Sun, 26 Mar 2017 16:48:32 GMT
Via: 1.1 varnish
Age: 8
Connection: keep-alive
X-Served-By: cache-sjc3643-SJC
X-Cache: HIT
X-Cache-Hits: 1
X-Timer: S1490546912.519996,VS0,VE0
Vary: Accept-Encoding
X-Fastly-Request-ID: 7488ce79da2023aae9fc78dcf2f1e1cab1fd7ea5
stefanhaustein commented 7 years ago

Curl works just fine. Maybe some issue with the plugin? Given that the p2 plugin only works with an old version of gradle, perhaps this is not the best approach anyway.

Rüdiger Hermann recommends to try to turn your repository into a Maven repository. Do you know if this is feasible in place or if I'd need to maintain a fork for this?

Am I holding something wrong for "just" creating a build script for a libarary that depends on SWT (outside of Eclipse with "regular" tools such as Maven or Gradle)? Is there a cleaner / better / simpler way?

guw commented 7 years ago

I'm actually not sure. You only need those bits if your are performing a product build for all platforms. You don't need this dependency if you can tell p2 to just build specific platforms and do not build the once mentioned here.

FWIW, you should be able to experiment with building it locally by calling mvn install. This should deploy the artifacts into your local Maven repository.