Iam new to webservices and Iam trying to create a restful webservice invoking JSON data. After searching I thought I could use maven to create a webservice and used this link to create a webservice. I installed maven and tried to repeat the same steps given in the link. But when I run the application I get the below error.
"Failed to execute goal on project printer-status-webapp: Could not resolve dependencies forproject com.example:printer-status-webapp:jar:1.0-SNAPSHOT: Could not find artifact com.sun.jersey:jersey-grizzly:jar:1.0 in glassfish.java.net (http://download.java.net/maven/glassfish) "
I have tomcat running in my machine. I have not installed glassfish. Is it not possible to run the application with tomcat itself.
Anybody pls help me resolve this error.
Else any simple example for creating restful webservices with json data will also be helpful
Pls find the 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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>printer-status-webapp</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>printer-status-webapp</name>
<dependencies>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-grizzly</artifactId>
<version>${jersey-version}</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-json</artifactId>
<version>${jersey-version}</version>
</dependency>
<!-- uncomment this to get Fastinfoset support:
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-fastinfoset</artifactId>
<version>${jersey-version}</version>
</dependency>
-->
<!-- uncomment this to get ATOM support:
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-atom</artifactId>
<version>${jersey-version}</version>
</dependency>
-->
<!-- uncomment this to get multipart MIME types support:
<dependency>
<groupId>com.sun.jersey.contribs</groupId>
<artifactId>jersey-multipart</artifactId>
<version>${jersey-version}</version>
</dependency>
-->
<dependency>
<groupId>com.sun.grizzly</groupId>
<artifactId>grizzly-servlet-webserver</artifactId>
<version>1.9.31</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-client</artifactId>
<version>${jersey-version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<inherited>true</inherited>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<configuration>
<url>http://172.16.109.209:8080/manager</url>
<server>mytomcat</server>
<path>/mywebapp</path>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>com.example.Main</mainClass>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<jersey-version>1.0</jersey-version>
</properties>
<!-- <repositories>
<repository>
<id>glassfish.java.net</id>
<name>GlassFish Maven Repository</name>
<url>http://download.java.net/maven/glassfish</url>
<layout>default</layout>
</repository>
<repository>
<id>m2.java.net</id>
<name>Java.net Maven 2 Repository</name>
<url>http://download.java.net/maven/2</url>
<layout>default</layout>
</repository>
</repositories> -->
Thanks
The error is basically telling you that maven is looking for the dependency "com.sun.jersey:jersey-grizzly:jar:1.0" in the repository "http://download.java.net/maven/glassfish" that is your pom.xml and it can not find it.
Do you try it with the Maven Central Repository??
Adding Maven central repository:
<repositories>
<repository>
<id>central</id>
<name>Maven Repository Switchboard</name>
<layout>default</layout>
<url>http://repo1.maven.org/maven2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
Related
First of all let me admit that this is a question I see all over the Internet. I have tried many of the solutions I have seen with no luck on my end.
So, I have this maven project
<groupId>com.mycompany.InfoFinder</groupId>
<artifactId>InfoFinder</artifactId>
<version>1.0.6.4</version>
and a different project that depends on the first one.
<groupId>com.mycompany.update</groupId>
<artifactId>updates</artifactId>
<version>1.0.44.8</version>
....
<dependency>
<groupId>com.mycompany.InfoFinder</groupId>
<artifactId>InfoFinder</artifactId>
<version>1.0.6.4</version>
<dependency>
When I run mvn clean install -U I get this
.../src/main/java/com/mycompany/Update.java:[3,48] package com.mycompany.companyInfo does not exist
.../src/main/java/eu/com/mycompany/Update.java:[51,36] cannot find symbol....
This line refers to the dependency class, which on eclipse I can click on it and it will open the proper file.
If I change my dependency to the older version
<version>1.0.6.4</version>
It is working just fine.
I can see the folder under the .m2 folder and I tried deleting it with no difference. I also tried different mvn commands, such as dependency:purge-local-repository clean install in order to clear the cache memory, but still with no luck.
I have tried to update/clear the maven and the java project within the eclipse environment, but that didn't work either.
I should admit that this is not the fist time I see this error, but it usually goes away after a few builds attempts.
Can you tell what I am doing wrong.
PS. The projects builds and runs just fine under the eclipse IDE, so the problem must be on the maven end. Also, since maven doesn't complain when I use the older version of the dependency, that should mean that the problem is on the building of the dependency.
Thanks
EDIT
I of course first successfully build the first project (lets call it project A) and then the one that depends on it (lets call it project B), and I get the error there.
The pom files of the two projects are as follow
project A
<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.mycompany.InfoFinder</groupId>
<artifactId>InfoFinder</artifactId>
<version>1.0.6.4</version>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
</plugins>
</pluginManagement>
</build>
<distributionManagement>
<repository>
... </repository>
<snapshotRepository>
... </snapshotRepository>
</distributionManagement>
<dependencies>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5</version>
</dependency>
<dependency>
<groupId>com.mycompany.AgeCalculator</groupId>
<artifactId>AgeCalculator</artifactId>
<version>1.0.3</version>
</dependency>
<dependency>
<groupId>eu.linkedbusiness.tool.selenium.imports</groupId>
<artifactId>seleniumImports</artifactId>
<version>1.0.3-RELEASE</version>
</dependency>
<dependency>
<groupId>com.mycompany.solver</groupId>
<artifactId>solver</artifactId>
<version>[1,)</version>
</dependency>
</dependencies>
</project>
project B
<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.mycompany.update</groupId>
<artifactId>updates</artifactId>
<version>1.0.44.8</version>
<repositories>
<repository>
<releases>
<enabled>false</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
<checksumPolicy>fail</checksumPolicy>
</snapshots>....
<layout>default</layout>
</repository>
<repository>
<releases>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
<updatePolicy>never</updatePolicy>
<checksumPolicy>fail</checksumPolicy>
</snapshots>
<name>Nexus RELEASE</name>...
<layout>default</layout>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.13.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
</dependency>
<dependency>
<groupId>com.mycompany.Calculator</groupId>
<artifactId>Calculator</artifactId>
<version>LATEST</version>
</dependency>
<dependency>
<groupId>com.mycompany.ExtraMetadata</groupId>
<artifactId>ExtraMetadata</artifactId>
<version>LATEST</version>
</dependency>
<dependency>
<groupId>com.mycompany.InfoFinder</groupId>
<artifactId>InfoFinder</artifactId>
<version>1.0.6.4</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>1.7.6</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.6</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.6</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>
....Main
</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id> <!-- this is used for inheritance merges -->
<phase>package</phase> <!-- bind to the packaging phase -->
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
</plugins>
</build>
<distributionManagement>
<snapshotRepository>....
</snapshotRepository>
<repository>...
</repository>
</distributionManagement>
</project>
I Trying to test my app with vaadin testbench but when I try to run my test with
mvn clean verify he don`t start my server to execute the tests, I using this sample: https://vaadin.com/docs/-/part/testbench/testBench-tutorial.html and this is my pom.xml
<?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>br.com.lumera</groupId>
<artifactId>integra</artifactId>
<packaging>war</packaging>
<version>1.0</version>
<name>integra</name>
<prerequisites>
<maven>3</maven>
</prerequisites>
<properties>
<vaadin.version>7.7.0</vaadin.version>
<vaadin.plugin.version>${vaadin.version}</vaadin.plugin.version>
<vaadin.testbench.version>4.1.0.alpha2</vaadin.testbench.version>
<jetty.plugin.version>9.3.9.v20160517</jetty.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<!-- If there are no local customisations, this can also be "fetch" or
"cdn" -->
<vaadin.widgetset.mode>local</vaadin.widgetset.mode>
</properties>
<repositories>
<repository>
<id>vaadin-addons</id>
<url>http://maven.vaadin.com/vaadin-addons</url>
</repository>
<repository>
<id>vaadin-snapshots</id>
<url>http://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>vaadin-snapshots</id>
<url>http://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-bom</artifactId>
<version>${vaadin.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<!-- Exclude an unnecessary file generated by the GWT compiler. -->
<packagingExcludes>WEB-INF/classes/VAADIN/widgetsets/WEB-INF/**</packagingExcludes>
</configuration>
</plugin>
<plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<version>${vaadin.plugin.version}</version>
<executions>
<execution>
<goals>
<goal>update-theme</goal>
<goal>update-widgetset</goal>
<goal>compile</goal>
<!-- Comment out compile-theme goal to use on-the-fly theme compilation -->
<goal>compile-theme</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>3.0.0</version>
<!-- Clean up also any pre-compiled themes -->
<configuration>
<filesets>
<fileset>
<directory>src/main/webapp/VAADIN/themes</directory>
<includes>
<include>**/styles.css</include>
<include>**/styles.scss.cache</include>
</includes>
</fileset>
</filesets>
</configuration>
</plugin>
<!-- The Jetty plugin allows us to easily test the development build by
running jetty:run on the command line. -->
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${jetty.plugin.version}</version>
<configuration>
<scanIntervalSeconds>2</scanIntervalSeconds>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jackson2-provider</artifactId>
<version>3.0.19.Final</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-client</artifactId>
<version>3.0.19.Final</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-testbench-api</artifactId>
<version>${vaadin.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.vaadin.addons</groupId>
<artifactId>ckeditor-wrapper-for-vaadin</artifactId>
<version>7.10.9</version>
</dependency>
<dependency>
<groupId>org.vaadin.addon</groupId>
<artifactId>easyuploads</artifactId>
<version>7.4.6</version>
</dependency>
<dependency>
<groupId>org.vaadin.addons</groupId>
<artifactId>vaadin-grid-util</artifactId>
<version>1.0.8</version>
</dependency>
<dependency>
<groupId>de.steinwedel.vaadin.addon</groupId>
<artifactId>messagebox</artifactId>
<version>3.0.17</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-testbench</artifactId>
<version>4.1.0.alpha2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.vaadin.addons</groupId>
<artifactId>vaadin-combobox-multiselect</artifactId>
<version>1.1.11</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-server</artifactId>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-push</artifactId>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client-compiled</artifactId>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-themes</artifactId>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>19.0</version>
</dependency>
</dependencies>
<profiles>
<profile>
<!-- Vaadin pre-release repositories -->
<id>vaadin-prerelease</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<repositories>
<repository>
<id>vaadin-addons</id>
<url>http://maven.vaadin.com/vaadin-addons</url>
</repository>
<repository>
<id>vaadin-prereleases</id>
<url>http://maven.vaadin.com/vaadin-prereleases</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>vaadin-prereleases</id>
<url>http://maven.vaadin.com/vaadin-prereleases</url>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
</project>
But I have noted that when start my server before run tests, my test pass, but after run the tests he tried to start my server
I Put the original start/stop jetty
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${jetty.plugin.version}</version>
<configuration>
<scanIntervalSeconds>2</scanIntervalSeconds>
</configuration>
</plugin>
but don`t work.
I don't see any Jetty configuration described in the "Start the Server Automatically" section of the linked document. The start and stop goals which are there tied to the pre-integration-test/post-integration-test phase will take care of starting the server before integration tests are run and stopping it afterwards.
Finally you need to ensure that your test is run in the integration test phase and not in the unit test phase. If they are run in the unit test phase, the pre-integration-test phase has not yet been executed and the server has not been started. Name your test SomethingIT.java (not SomethingTest.java) to ensure that it is run in the integration test phase.
Because the issue reported here, I used the 3.3.1 connector version in a non-maven mule project and worked perfectly.
However, I want to add the redis on a maven mule project. But, the redis docs only gives me 2 options: The Release or the Latest version. Both cause the issue reported above.
I have tried to change the version to 3.3.1 or 3.3.2 but when I try to start the project, I got the following error:
Failed to execute goal on project single-sign-on: Could not resolve dependencies for project br.com.xpto:single-sign-on:mule:1.0.0-SNAPSHOT: Failed to collect dependencies at org.mule.modules:mule-module-redis:jar:3.3.2 -> org.mule.tools.devkit:mule-devkit-annotations:jar:3.3.1 -> org.mule.modules:mule-module-annotations:jar:3.3.0 -> org.mule:mule-core:jar:3.3.0 -> javax.activation:activation:jar:1.1-osgi: Failed to read artifact descriptor for javax.activation:activation:jar:1.1-osgi: Could not transfer artifact javax.activation:activation:pom:1.1-osgi from/to codehaus-snaphosts (http://snapshots.repository.codehaus.org/): snapshots.repository.codehaus.org
Question: Does anyone know how to add the redis dependency on a maven project without being the release or the latest?
UPDATE
In order to help you guys understand my problem, I will add my pom.xml below
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany</groupId>
<artifactId>xpto</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>mule</packaging>
<name>Mule xpto Application</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<mule.version>3.7.0</mule.version>
<mule.tools.version>1.1</mule.tools.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.mule.tools.maven</groupId>
<artifactId>mule-app-maven-plugin</artifactId>
<version>${mule.tools.version}</version>
<extensions>true</extensions>
<configuration>
<copyToAppsDirectory>true</copyToAppsDirectory>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2.1</version>
<configuration>
<descriptorRefs>
<descriptorRef>project</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>add-resource</id>
<phase>generate-resources</phase>
<goals>
<goal>add-resource</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>src/main/app/</directory>
</resource>
<resource>
<directory>mappings/</directory>
</resource>
<resource>
<directory>src/main/api/</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.mule.tools</groupId>
<artifactId>maven-mule-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<excludeMuleDependencies>false</excludeMuleDependencies>
<inclusions>
<inclusion>
<groupId>org.mule.modules</groupId>
<artifactId>mule-module-redis</artifactId>
</inclusion>
</inclusions>
</configuration>
</plugin>
</plugins>
</build>
<!-- Mule Dependencies -->
<dependencies>
<!-- Xml configuration -->
<dependency>
<groupId>org.mule.modules</groupId>
<artifactId>mule-module-spring-config</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<!-- Mule Transports -->
<dependency>
<groupId>org.mule.transports</groupId>
<artifactId>mule-transport-file</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mule.transports</groupId>
<artifactId>mule-transport-http</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mule.transports</groupId>
<artifactId>mule-transport-jdbc</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mule.transports</groupId>
<artifactId>mule-transport-jms</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mule.transports</groupId>
<artifactId>mule-transport-vm</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<!-- Mule Modules -->
<dependency>
<groupId>org.mule.modules</groupId>
<artifactId>mule-module-scripting</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mule.modules</groupId>
<artifactId>mule-module-xml</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<!-- for testing -->
<dependency>
<groupId>org.mule.tests</groupId>
<artifactId>mule-tests-functional</artifactId>
<version>${mule.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mule.modules</groupId>
<artifactId>mule-module-http</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mule.modules</groupId>
<artifactId>mule-module-redis</artifactId>
<version>3.3.2</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>Central</id>
<name>Central</name>
<url>http://repo1.maven.org/maven2/</url>
<layout>default</layout>
</repository>
<repository>
<id>mulesoft-releases</id>
<name>MuleSoft Releases Repository</name>
<url>http://repository.mulesoft.org/releases/</url>
<layout>default</layout>
</repository>
<repository>
<id>mulesoft-snapshots</id>
<name>MuleSoft Snapshot Repository</name>
<url>http://repository.mulesoft.org/snapshots/</url>
<layout>default</layout>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>mulesoft-release</id>
<name>mulesoft release repository</name>
<layout>default</layout>
<url>http://repository.mulesoft.org/releases/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
So the key points of the pom.xml above are:
1- The repositories
<repository>
<id>mulesoft-releases</id>
<name>MuleSoft Releases Repository</name>
<url>http://repository.mulesoft.org/releases/</url>
<layout>default</layout>
</repository>
<repository>
<id>mulesoft-snapshots</id>
<name>MuleSoft Snapshot Repository</name>
<url>http://repository.mulesoft.org/snapshots/</url>
<layout>default</layout>
</repository>
2- The dependecy
<dependency>
<groupId>org.mule.modules</groupId>
<artifactId>mule-module-redis</artifactId>
<version>3.3.2</version>
</dependency>
When I try to start the application, got the following error
BUILD FAILURE
[ERROR] Failed to execute goal on project xpto: Could not resolve
dependencies for project com.mycompany:xpto:mule:1.0.0-SNAPSHOT:
Failed to collect dependencies at org.mule.modules:mule-module-redis:jar:3.3.2 ->
org.mule.tools.devkit:mule-devkit-annotations:jar:3.3.1 ->
org.mule.modules:mule-module-annotations:jar:3.3.0 -> org.mule:mule-core:jar:3.3.0
-> javax.activation:activation:jar:1.1-osgi: Failed to read artifact descriptor for
javax.activation:activation:jar:1.1-osgi: Could not transfer artifact
javax.activation:activation:pom:1.1-osgi from/to codehaus-snaphosts (http://snapshots.repository.codehaus.org/):
snapshots.repository.codehaus.org -> [Help 1]
UPDATE 2
Executing the command mvn dependency:tree -Dincludes=javax.activation I got the following output:
Downloading: http://snapshots.repository.codehaus.org/org/apache/geronimo/specs/geronimo-j2ee-connector_1.5_spec/1.1-osgi/geronimo-j2ee-connector_1.5_spec-1.1-osgi.pom
Downloading: http://repository.codehaus.org/org/apache/geronimo/specs/geronimo-j2ee-connector_1.5_spec/1.1-osgi/geronimo-j2ee-connector_1.5_spec-1.1-osgi.pom
Downloading: http://repository.codehaus.org/org/apache/geronimo/specs/geronimo-j2ee-connector_1.5_spec/1.1-osgi/geronimo-j2ee-connector_1.5_spec-1.1-osgi.pom
BUILD FAILURE
[ERROR] Failed to execute goal on project xpto: Could not resolve dependencies for project com.mycompany:xpto:mule:1.0.0-SNAPSHOT: Failed to collect dependencies at org.mule.modules:mule-module-redis:jar:3.3.2 -> org.mule.tools.devkit:mule-devkit-annotations:jar:3.3.1 -> org.mule.modules:mule-module-annotations:jar:3.3.0 -> org.mule:mule-core:jar:3.3.0 -> org.apache.geronimo.specs:geronimo-j2ee-connector_1.5_spec:jar:1.1-osgi: Failed to read artifact descriptor for org.apache.geronimo.specs:geronimo-j2ee-connector_1.5_spec:jar:1.1-osgi: Could not transfer artifact org.apache.geronimo.specs:geronimo-j2ee-connector_1.5_spec:pom:1.1-osgi from/to codehaus-snaphosts (http://snapshots.repository.codehaus.org/): snapshots.repository.codehaus.org -> [Help 1]
Add the following repository to your pom so that javax/activation/activation/1.1-osgi can be found:
<repository>
<id>codehaus-mule-repo</id>
<name>codehaus-mule-repo</name>
<url>
https://repository.mulesoft.org/nexus/content/groups/public/
</url>
<layout>default</layout>
</repository>
<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/maven-v4_0_0.xsd ">
<modelVersion>4.0.0</modelVersion>
<groupId>org.geoserver</groupId>
<artifactId>hello_wps</artifactId>
<packaging>jar</packaging>
<version>8-ENTERPRISE-SNAPSHOT</version>
<name>hello_wps</name>
<dependencies>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-process</artifactId>
<version>8-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.geoserver</groupId>
<artifactId>main</artifactId>
<version>8-ENTERPRISE-SNAPSHOT</version>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.mockrunner</groupId>
<artifactId>mockrunner</artifactId>
<version>0.3.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>opengeo</id>
<name>opengeo</name>
<url>http://repo.opengeo.org</url>
</repository>
</repositories>
</project>
i'm new to maven and geoserver as well. was just trying basic installation of geoserver and found the error in POM.XML file of maven project. Error is shown in two <dependency> tabs which are exactly 1st and 2nd after <dependencies> tab.
Errors :
Missing artifact org.geotools:gt-process:jar:8-SNAPSHOT
Missing artifact org.geoserver:main:jar:tests:8-ENTERPRISE-SNAPSHOT
Thanks for the solution in advance.
If you look at the quick start docs for geotools:
http://docs.geotools.org/latest/userguide/tutorial/quickstart/maven.html
step 7 "under Creating a new project"
If you are using a nightly build (such as 14-SNAPSHOT) and add a
reference to the snapshot repository.
<repositories>
<repository>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>boundless</id>
<name>Boundless Maven Repository</name>
<url>http://repo.boundlessgeo.com/main</url>
</repository>
</repositories>
I have taken a quick look at the versions available in this repository and to use it, you will need to change your maven co-ordinates to something like:
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-process</artifactId>
<version>10-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.geoserver</groupId>
<artifactId>main</artifactId>
<version>2.4.8</version>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
as the original versions you are after are not present.
I have in my application JUnit tests to run, but these JUnit tests are created and compiled at runtime. I'm loading a text template, replace some class tags and want to compile this source code at runtime with the javax.tools.Compiler from java.
I'm deploying and running this application on a glassfish 3 and it seems to be the problem, that the compiler can't find the JUnit library (but it is included in the .war) and throwing compile exceptions. The created JUnit test source code would compile, there are no syntax errors or something like that.
The application is build via maven, here is the pom.xml:
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.phoenix</groupId>
<artifactId>WebService</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>WebService Jersey Webapp</name>
<build>
<finalName>PhoenixWebService</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<inherited>true</inherited>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
<version>3.1</version>
</plugin>
<plugin>
<groupId>org.glassfish</groupId>
<artifactId>maven-glassfish-plugin</artifactId>
<version>2.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.16</version>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>${jersey-version}</version>
</dependency>
<dependency>
<groupId>com.sun.jersey.contribs</groupId>
<artifactId>jersey-multipart</artifactId>
<version>${jersey-version}</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.7</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-client</artifactId>
<version>${jersey-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sun.jersey.jersey-test-framework</groupId>
<artifactId>jersey-test-framework-grizzly2</artifactId>
<version>${jersey-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.glassfish.embedded</groupId>
<artifactId>gf-embedded-api</artifactId>
<version>1.0-alpha-4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>de.phoenix</groupId>
<artifactId>library</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time-hibernate</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.5.0</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>${hibernate-version}</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.24</version>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<jersey-version>1.17.1</jersey-version>
<hibernate-version>3.6.10.Final</hibernate-version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<repositories>
<repository>
<id>glassfish.java.net</id>
<name>GlassFish Maven Repository</name>
<url>http://download.java.net/maven/glassfish</url>
<layout>default</layout>
</repository>
<repository>
<id>m2.java.net</id>
<name>Java.net Maven 2 Repository</name>
<url>http://download.java.net/maven/2</url>
<layout>default</layout>
</repository>
<repository>
<id>phoenixNexus</id>
<name>Phoenix Maven 2 Repository</name>
<url>http://meldanor.dyndns.org:8081/nexus/content/groups/public/</url>
<layout>default</layout>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>m2.java.net</id>
<name>Java.net Maven 2 Repository</name>
<url>http://download.java.net/maven/2</url>
<layout>default</layout>
</pluginRepository>
</pluginRepositories>
<distributionManagement>
<repository>
<id>phoenixNexus</id>
<name>Internal Releases</name>
<url>http://meldanor.dyndns.org:8081/nexus/content/repositories/releases</url>
</repository>
<snapshotRepository>
<id>phoenixNexus</id>
<name>Internal Releases</name>
<url>http://meldanor.dyndns.org:8081/nexus/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
I'm using a little modified version of the CharSequenceCompiler (http://www.ibm.com/developerworks/library/j-jcomp/) to compile the classes at runtime.
The compiler is working for source code using only jdk classes.
Any ideas?