Problem resolving profiled dependency from maven repository


(torsten.beuck) #1

Hi,

I’m just trying to migrate an eclipse plugin project from maven to gradle, reusing an existing internal maven repository. The problem is that the dependency to the OS specific eclipse SWT plugin cannot be resolved. I’m getting the following message:

* What went wrong:
Could not resolve all dependencies for configuration ':compile'.
> Could not find group:unknown, module:unknown, version:3.7.2.
  Required by:
      :myplugin:unspecified > org.eclipse:jface:3.7.0 > org.eclipse:swt:3.7.2

In the pom of the SWT plugin the OS specific dependency is defined using profiles:

...
  <profiles>
    <profile>
      <id>swt.win32-win32-x86</id>
      <activation>
        <os>
          <family>windows</family>
          <arch>x86</arch>
        </os>
      </activation>
      <properties>
        <swt.groupId>org.eclipse.swt.win32.win32</swt.groupId>
        <swt.artifactId>x86</swt.artifactId>
      </properties>
    </profile>
    <profile>
      <id>swt.gtk-linux-x86_64</id>
  ...
      </profiles>
  <dependencies>
    <dependency>
      <groupId>${swt.groupId}</groupId>
      <artifactId>${swt.artifactId}</artifactId>
      <version>3.7.2</version>
    </dependency>
  </dependencies>
  ...

Has anyone an idea regarding this problem? Without solving it I cannot migrate to gradle.

Regards


(Peter Niederwieser) #2

Using profiles in published POMs is highly discouraged, and their behavior is undefined. From what I know, Gradle skips them.


(torsten.beuck) #3

Hi Peter,

what a pity. I cannot modify the SWT plugin pom because other projects are depending on the OS specific build. Do you have any idea for a workaround that enables me to use Gradle instead of Maven?

BTW: Thanks for the prompt reply.


(Peter Niederwieser) #4

You can republish the artifact with a corrected POM to your repository manager. Alternatively you can try to reference the artifact with “org.eclipse:swt:3.7.2@jar” and declare its transitive dependencies manually. More on that in the Gradle user guide.