By declaring the following dependency:
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
I can use about everything I need for a Java EE 6 Project (Servlet 3.0, JPA 2, EJB, CDI, etc).
The problem is: Maven can not download the Javadocs for the dependency (or at least m2eclipse "Download JavaDoc" feature don't work), so Eclipse don't show me the Javadocs when I use the very handy code completion feature.
I've found this post specific to Servlet 3.0 API, Maven dependency for Servlet 3.0 API?.
Can anyone kindly point to a solution that works for every API? Or, can anyone please provide a dummy guide to install Java EE 6 Javadocs and link it to javaee-web-api artifact in the local repository?
Assuming you have Java EE javadocs, you can install them to your local maven repository using the maven install plugin. Look at this usage link
You would use the -Dclassifier=sources to indicate you are installing sources. See this example for this.
Related
I am trying to use "swagger-jaxrs-maven" plugin to generate RESTful API docs from the source code.
I followed this web site:
swagger-jaxrs-maven
but maven complained that it can't find this plugin, so I searched it on
maven central repository
It only finds it under groupId com.greensopinion.swagger. So I changed it accordingly.
But now I get this error:
[ERROR] Failed to execute goal
com.greensopinion.swagger:jaxrs-gen:1.3.0:generate (default) on
project treaty: Execution default of goal com.greensopinion.swagg
er:jaxrs-gen:1.3.0:generate failed: Unable to load the mojo 'generate'
in the plugin 'com.greensopinion.swagger:jaxrs-gen:1.3.0' due to an
API incompatibility:
org.codehaus.plexus.component.repository.exception.ComponentLookupException:
com/greensopinion/swagger/jaxrsgen/SwaggerJaxrsGeneratorMojo :
Unsupported major.mi nor version 52.0
I cleaned all my local maven repository and re-tried, it doesn't work.
My maven is 3.2.3 and JDK is 1.7.
My RESTful framework is Jersey2.17 with Jackson.
Any suggestion on how to make it work?
This issue is not related to swagger or maven but to your JDK version (version 52.0 means a JDK 8 is expected).
See https://stackoverflow.com/a/35866015/779338 for mode details.
Furthermore, if you download the pom.xml of swagger-jaxrs-maven available in maven central repository, you can see that a JDK8 (maven.compiler.source=1.8) has been used to generate a java 8 package (maven.compiler.target=1.8), then it can't be used with a JDK7.
I have following Maven dependencies, it turns out fine.
For Swagger, Phillip project which just plug and play.
<dependency>
<groupId>com.github.phillip-kruger</groupId>
<artifactId>apiee-core</artifactId>
<version>1.0.8</version>
</dependency>
JAVA EE - JAX-RS api
<!-- Java EE -->
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
Use JDK 1.8 or above.
I use eclipse and wildly server.
I'm working on a project that incorporates some Jersey dependencies not packaged with Glassfish and need to know what version of Jersey Glassfish 4.1.1 is using.
In the Glassfish Maven pom.xml, here
https://maven.java.net/content/repositories/releases/org/glassfish/main/extras/glassfish-embedded-all/4.1.1/glassfish-embedded-all-4.1.1.pom, there is a reference to Jersey:
<dependency>
<groupId>org.glassfish.main.packager</groupId>
<artifactId>jersey</artifactId>
<version>${project.version}</version>
<type>zip</type>
<optional>true</optional>
</dependency>
Which is actually a reference to the Jersey version embedded in Glassfish, here https://maven.java.net/content/repositories/releases/org/glassfish/main/packager/jersey/4.1.1/jersey-4.1.1.pom.
So from my understanding, Glassfish copies its dependencies at the time they are included into its own repository without retaining version information. How do I get that version information?
As mentioned in Updating Jersey 2 in GlassFish 4, two options mentioned are to:
Just unzip one of the Jersey jars e.g. (jersey-common) and look at the Bundle-Version in the META-INF/MANIFEST.MF file. You can find the jars in <glassfish-home>/glasssfish/modules
Just start up the server, with a JAX-RS application running and
log
Initiating Jersey application, version Jersey: 2.5.1 2014-01-02 13:43:00...]]
i am new to spring framework. When i try to download required jar files for spring, then there is 2 options for same classes-
org.springframework.xyz-2.5.6.A.jar and spring-xyz-2.5.6.RELEASE.jar.
I want to know what is the difference and which is recommended to use?
thanks.
The org.springframework.xyz version is the artifact ID used by SpringSource in their Enterprise Bundle Repository, a self-contained set of OSGi-compliant JARs for both Spring and non-Spring artifacts. The spring-xyz version is the standard non-OSGi version available on Maven Central.
If you're using OSGi then use the EBR JARs, if you're not then use the standard ones.
The current Maven dependency for spring-context is
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>3.2.4.RELEASE</version>
</dependency>
The resulting JAR is spring-context-3.2.4.RELEASE.jar.
So the second name looks OK to me.
I am trying to run sample guessnumber-jsf from Java EE tutorial. It is here: https://svn.java.net/svn/javaeetutorial~svn
There is no dependencies in pom.xml. So output file has no .jar file. When I try to put javaee-api-7.0-b83.jar inside tomcat/lib or WEB-INF/lib/javaee-api-7.0-b83.jar, nothing changes.
When I try to open
localhost:8080/guessnumber-jsf/faces/greeting.xhtml
I get ClassNotFoundException. Where can I get list of jars that I need for faces tutorial? How can I connect them?
You can't put that Java EE jar in Tomcat and expect it to magically morph into a Java EE server.
That particular jar only contains the APIs to link against (eg "headers" in C/C++ terminology). It does not contain any implementation.
The easiest thing to do is to dish Tomcat and download TomEE instead. Optionally download GlassFish.
These will all already contain all the functionality you need and nothing will have to be put into WEB-INF/lib. (if using Maven put the Java EE 6 GAV as a dependency with scope provided in your pom).
If you are using a Maven project you can fix this error by adding the following dependency:
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.faces</artifactId>
<version>2.2.7</version>
</dependency>
Adding to the answer of Mike Braun, the Java EE 6 GAV for the web profile is:
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>6</version>
<scope>provided</scope>
</dependency>
Specifically note the scope: "provided". This means your Maven project will link against this, but it expects your runtime to have the implementations. For TomEE, GlassFish, JBoss AS 7.x, etc this is indeed the case.
In your classpath (.classpath) make sure you have entry like
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
I'm converting an ANT project that uses CXF into a Maven one. The problem is that this projects depends on CXF v2.2.6 and when I go to here or even here, there is no jar to download. I don't know what to do. I have the JAR but I want to use the Maven features like dependency management.
Thanks for your help
If using Ant, it likely used the cxf-bundle jar that pretty much contains all of CXF. You can just add:
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-bundle</artifactId>
<version>2.2.6</version>
</dependency>
to your new pom and it would get that jar along with all the dependencies that it would require.
It is available at Maven central. Use repo1.maven.org as your repository.
Either install it manually to your local repository or use a repository manager like Nexus.