vendredi 13 mars 2015

Cannot find symbol PathParam in Jersey



Here's my code



@Path("/users/{id}")
public class MyResource {

@GET
@Produces(MediaType.TEXT_PLAIN)
public String getId(@PathParam("id") String id) {
return "Getting Messages for User : " + id;
}
}


All i get is



..MyResource.java:[17,29] error: cannot find symbol


So far i have checked both this http://ift.tt/19gL75Q


& this


maven "cannot find symbol" message unhelpful


but without any success.


EDIT: pom.xml



<project xmlns="http://ift.tt/IH78KX" xmlns:xsi="http://ift.tt/ra1lAU"
xsi:schemaLocation="http://ift.tt/IH78KX http://ift.tt/HBk9RF">

<modelVersion>4.0.0</modelVersion>

<groupId>com.placeholder</groupId>
<artifactId>edelivery-sp</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>edelivery-sp</name>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.glassfish.jersey</groupId>
<artifactId>jersey-bom</artifactId>
<version>${jersey.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-grizzly2-http</artifactId>
</dependency>
<!-- uncomment this to get JSON support:
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-moxy</artifactId>
</dependency>
-->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.9</version>
<scope>test</scope>
</dependency>

</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<inherited>true</inherited>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>com.placeholder.Main</mainClass>
</configuration>
</plugin>
</plugins>
</build>

<properties>
<jersey.version>2.16</jersey.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

</project>



Aucun commentaire:

Enregistrer un commentaire