79242808

Date: 2024-12-02 02:00:25
Score: 1.5
Natty:
Report link

I found a method to get past the problem. This method does not require putting the SWT jar files into the local repository. There are 2 tricks required to get this to work.

  1. As suggested by @greg-449 download the SDK from the Eclipse Archive. Locate and copy the appropriate files. I tried copying Eclipse SDK 4.1.2, and copied these files:

I put these under a lib folder under the top level. There is probably a more elegant place to put them.

  1. Use this StackOverflow answer to hard-code local files in the pom.xml.

In my case, it looked like this:

    <dependency>
        <groupId>org.eclipse.platform</groupId>
        <artifactId>org.eclipse.swt</artifactId>
        <version>3.7.2</version>
        <scope>system</scope>
        <systemPath>${project.basedir}/lib/org.eclipse.swt_3.7.2.v3740f.jar</systemPath>
    </dependency>
    <dependency>
        <groupId>org.eclipse.platform</groupId>
        <artifactId>org.eclipse.swt.win32.win32.x86_64</artifactId>
        <version>3.7.2</version>
        <scope>system</scope>
        <systemPath>${project.basedir}/lib/org.eclipse.swt.win32.win32.x86_64_3.7.2.v3740f.jar</systemPath>
    </dependency>
    <dependency>
        <groupId>org.eclipse.platform</groupId>
        <artifactId>org.eclipse.jface</artifactId>
        <version>3.7.0</version>
        <scope>system</scope>
        <systemPath>${project.basedir}/lib/org.eclipse.jface_3.7.0.v20110928-1505.jar</systemPath>
    </dependency>
    <dependency>
        <groupId>org.eclipse.platform</groupId>
        <artifactId>org.eclipse.core.commands</artifactId>
        <version>3.6.0</version>
        <scope>system</scope>
        <systemPath>${project.basedir}/lib/org.eclipse.core.commands_3.6.0.I20110111-0800.jar</systemPath>
    </dependency>

I do not know if the groupId and artifactId values are correct, but it is good enough to get the old code to compile.

Also there will be some Maven warnings as shown below, but in my case I just want it to compile. You can get change to a different warning by hard-coding the full path instead of using the relative variable.

[WARNING] 'dependencies.dependency.systemPath' for org.eclipse.platform:org.eclipse.swt:jar should not point at files within the project directory, ${project.basedir}/lib/org.eclipse.swt_3.7.2.v3740f.jar will be unresolvable by dependent projects
Reasons:
  • Blacklisted phrase (1): StackOverflow
  • Long answer (-1):
  • Has code block (-0.5):
  • User mentioned (1): @greg-449
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: Pixel