Search code examples
javamavenlwjgl

LWJGL project error in pom.xml: Missing artifact org.lwjgl:lwjgl-platform:jar:natives-windows:${lwjgl.version}


So I'm trying to teach myself LWJGl for fun, so I make the project file, put the things into the pom.xml file, and then I get this error:

Missing artifact org.lwjgl:lwjgl-platform:jar:natives-windows:${lwjgl.version}

This is my pom.xml file:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>learninglwjgl</groupId>
  <artifactId>learninglwjgl</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>learninglwjgl</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
     <dependency>
            <groupId>org.lwjgl</groupId>
            <artifactId>lwjgl-platform</artifactId>
            <version>${lwjgl.version}</version>
            <classifier>${native.target}</classifier>
        </dependency>
  </dependencies>

   <profiles>
        <profile>
            <id>windows-profile</id>
            <activation>
                <os>
                    <family>Windows</family>
                </os>
            </activation>
            <properties>
                <native.target>natives-windows</native.target>
            </properties>                
        </profile>
        <profile>
            <id>linux-profile</id>
            <activation>
                <os>
                    <family>Linux</family>
                </os>
            </activation>
            <properties>
                <native.target>natives-linux</native.target>
            </properties>                
        </profile>
        <profile>
            <id>OSX-profile</id>
            <activation>
                <os>
                    <family>mac</family>
                </os>
            </activation>
            <properties>
                <native.target>natives-osx</native.target>
            </properties>
        </profile>
    </profiles>

</project>

Any help would be appreciated, thanks :)


Solution

  • You should define a property for ${lwjgl.version}. As you can see at Maven Central, the only version of this artifact is 3.0.0 and you must explicitly define it. Please replace your <properties> tag with the following:

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <lwjgl.version>3.0.0</lwjgl.version>
    </properties>
    

    Also, you might want to get use of the offical LWJGL page describing setting up Maven project, as I am not sure if your pom.xml includes all necessary dependencies.