Details
-
Task
-
Status: Closed
-
Major
-
Resolution: Not A Problem
-
None
-
None
-
None
Description
Hey.
So, I'm trying to make a Web Application and a maven client that uses it. However, I get the "Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec" when ever I run it. Now when I try to do my teacher's example, I get the same problem. She doesn't seem to understand what the problem is, so I'm asking you all.
This is my pom.xml file:
<?xml version="1.0" encoding="UTF-8"?> <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>com.nackademin.systemintegration</groupId> <artifactId>WebApplicationClientDemo2</artifactId> <version>1.0-SNAPSHOT</version> <packaging>jar</packaging> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> </properties> <dependencies> <dependency> <groupId>com.sun.jersey</groupId> <artifactId>jersey-client</artifactId> <version>1.19.4</version> </dependency> <dependency> <groupId>javax</groupId> <artifactId>javaee-web-api</artifactId> <version>7.0</version> <type>jar</type> </dependency> <dependency> <groupId>com.sun.jersey</groupId> <artifactId>jersey-json</artifactId> <version>1.17.1</version> </dependency> <dependency> <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> <version>2.8.2</version> </dependency> </dependencies> </project>
This is the Web Application code I made:
BookDao bookdao = new BookDao(); @GET @Path("/books") @Produces(MediaType.APPLICATION_XML) public List<Book> getBooks() { return bookdao.getAllBooks(); }
And this is my maven client:
String xmlString = service.path("rest") .path("BookService/books").accept(MediaType.APPLICATION_XML).get(String.class); System.out.println(xmlString); System.out.println(); Book[] bookArray = service.path("rest") .path("BookService/books").accept(MediaType.APPLICATION_XML).get(Book[].class); for (Book b : bookArray) { System.out.println("Book id: " + b.getId() + " title: " + b.getTitle() + " author: " + b.getAuthor()); }
Do anyone know what the crap is the problem? Also, before anyone ask, yes, I've been on stackowerflow and search through google. I can't find anything that works.