I use Magnolia CMS and Blossom.
When I add annotations to my classes I get something like this:
annotations are not supported in -source 1.3 (use -source 5 or higher to enable annotations)
#Template(value="Blossom Template")*
Spring annotation(like #Controller) doesn't compile too.
Where is my mistake?
My pom.xml dependencies:
<dependencies>
<dependency>
<groupId>info.magnolia</groupId>
<artifactId>magnolia-module-blossom</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>info.magnolia</groupId>
<artifactId>magnolia-module-admininterface</artifactId>
<version>4.3.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>info.magnolia</groupId>
<artifactId>magnolia-taglib-cms</artifactId>
<version>4.3.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>info.magnolia</groupId>
<artifactId>magnolia-taglib-utility</artifactId>
<version>4.3.5</version>
<scope>provided</scope>
</dependency>
</dependencies>
You have to change your maven.compiler properties to compile with java 1.5.
<properties>
<!-- maven-compiler-plugin configuration -->
<maven.compiler.source>1.5</maven.compiler.source>
<maven.compiler.target>1.5</maven.compiler.target>
</properties>
Another way to do this (but less discreet) is this :
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
Resources :
http://maven.apache.org/ - compile MoJo - Source
On the same topic :
How can I force maven to package my project against 1.5?
I am happy this got answered but encourage you to use the Magnolia community, especially the mailing-list to ask questions about Magnolia in the future. This will benefit you and the community.
See http://www.magnolia-cms.com/home/community/mailing-lists.html
Thanks
- Boris
Related
I am creating Rest client using JAX RS Jersey 2. The client works but only in my IDE (IntellIJ IDEA), when I build it with Maven, using maven-assembly-plugin and run the jar it doesn't work anymore.
I get MessageBodyWriter not found for media type=application/json error.
I have tried adding more dependencies that people suggested in other posts but I don't think a dependency is a problem since it runs in the IDE.
Here is the code that throws the exception
return client.target(uri)
.request(MediaType.APPLICATION_JSON)
.post(Entity.entity(transactions.get(0), MediaType.APPLICATION_JSON));
After debugging, when I replace transactions.get(0) with an empty string "", it works.
Here is the pom.xml for maven
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>SequencerControllers</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.sparkjava</groupId>
<artifactId>spark-core</artifactId>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
<version>2.25.1</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
<version>2.25.1</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.21</version>
</dependency>
</dependencies>
Am i missing something? Really bothers me that it runs in the IDE but not when built with Maven since I build it with dependencies.
Check if you have class com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider in your resulting JAR. If not, add following dependency:
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>
<version>2.10.0</version>
</dependency>
there's an ordering issue as the Jackson and Jackson / jersey jars don't play well in an "uber" assembly jar. This is because they have same-named files in their individual jars that contain different values.
The assembly plugin will pick one version as the "winner" that gets included in the uber jar. The losing duplicate will not be included and in your case, you are likely getting the wrong copy included in your uber jar.
To fix this, make sure that these 2 entries are moved to the top of the maven dependencies list
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
<version>${jersey-version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>
<version>${jackson-version}</version>
</dependency>
I also moved this one at the bottom of the dependencies:
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson-version}</version>
</dependency>
That combination seemed to fix the uber jar issue in my situation.
I'm trying to upgrade an application to Java 11.0.2, from Java 8. So those are my very first steps with Jigsaw modules!
My application uses Guice, and the Assistedinject, and Throwingproviders extensions.
Here's my current module-info.java:
`
module com.example.mymodule {
requires com.google.guice;
requires com.google.guice.extensions.assistedinject;
requires com.google.guice.extensions.throwingproviders;
//...
}
`
The application is based on Maven and when I run mvn package I get no error. But In Eclipse (2018-12), I have this error "`The package com.google.inject is accessible from more than one module":
I tried commenting each of the required module in module-info.java but I clearly need the three of them.
Is there something I can do to remove this error? Or is this an Eclipse bug?
Here's 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>com.example</groupId>
<artifactId>example</artifactId>
<version>1.0.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.7</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>4.5.7</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.8.1</version>
</dependency>
<dependency>
<groupId>commons-validator</groupId>
<artifactId>commons-validator</artifactId>
<version>1.6</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
<version>1.6</version>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.11.3</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.26</version>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>4.2.2</version>
</dependency>
<dependency>
<groupId>com.google.inject.extensions</groupId>
<artifactId>guice-throwingproviders</artifactId>
<version>4.2.2</version>
</dependency>
<dependency>
<groupId>com.google.inject.extensions</groupId>
<artifactId>guice-assistedinject</artifactId>
<version>4.2.2</version>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
</plugins>
</build>
</project>
Here is a minimal project to reproduce my error.
And here's a video of the issue (to be watched in 1080P for clarity!).
Eclipse uses its own compiler which is even stricter than javac in following the specs. You are requiring different Modules/Jars in your module-info which are all using the package com.google.inject. This is some kind of a split package situation which is not allowed in the JPMS spec. AFAIK javac only yields an error if there are actual classes in the same packages of different moduls, but the eclipse compiler is even more picky here.
There are some solutions out there for solving split package problems. If you don't find a newer version of the libs where the problem is solved (which unfortunately is not very likely for most dependencies today) you could f.e. merge the modules into one custom modules, but this is not a perfect solution of course.
For more background information on the issue see also
Eclipse can't find XML related classes after switching build path to JDK 10 and https://bugs.openjdk.java.net/browse/JDK-8215739
I can reproduce the error on my machine (same Eclipse version, OpenJDK 11), works fine on Apache NetBeans IDE 10.0.
Seems to be a bug in Eclipse, you should file it here. You already have a minimal project that reproduces the error, that helps a lot.
Your test project already works in RC2 of 4.11 (which will be released on March 20, 2019)
You can download the release candidate at https://download.eclipse.org/eclipse/downloads/drops4/S-4.11RC2-201903070500/
Better way to deal with this kind of problem by just go to dependencies hierarchy in pom.xml, where you can find duplicate jar, sometimes it could be difficult to find duplicate jar as jar itself have pom dependencies and "Dependencies hierarchy" will help you to deal with maven problem
`
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.1</version>
By default this plugin gives Tomcat version 7.0.37, how can we point to Tomcat version 7.0.91?
As our security team came up with some vulnerabilities for 7.0.37, we need to upgrade to 7.0.91.
Is there any way we can configure the dependencies for the plugin?
there is a newer version of tomcat7-maven-plugin which uses the tomcat 7.0.47 version. Maybe you want to give it a try.
if you really want to update the version referenced by the plugin you can try to exclude the particular references in the plugin and add dependencies in the dependencies section for the ones you excluded.
<dependencies>
...
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-util</artifactId>
<version>7.0.91</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.1</version>
<dependencies>
<dependency>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.1</version>
<exclusions>
<exclusion>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-util</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</plugin>
<plugins>
<build>
Additional to the answer from aurelius and for documentation reasons:
It's also documented on the plugin page how to replace given tomcat dependencies with new ones:
https://tomcat.apache.org/maven-plugin-trunk/tomcat7-maven-plugin/adjust-embedded-tomcat-version.html
I know this is a duplicate question but the answers on other topics didn't help me.
I'm using Eclipse Photon, Java Version :10, I've set jdk/jre versions on 10 in eclipse and pom.xml file. I've changed eclipse.ini file :
-Dosgi.requiredJavaVersion=10 (it was set to 1.8)
and also I've added plugin in my pom.xml :
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>10</source>
<target>10</target>
</configuration>
</plugin>
Nothing helped. This is my 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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.luv2code</groupId>
<artifactId>spring-security-demo-06-user-roles</artifactId>
<version>1.0</version>
<packaging>war</packaging>
<name>spring-security-demo</name>
<properties>
<maven.compiler.source>10</maven.compiler.source>
<maven.compiler.target>10</maven.compiler.target>
</properties>
<dependencies>
<!-- Spring Security -->
<!-- Spring Security WEB -->
<!-- Spring Security taglibs -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>5.1.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>5.1.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-taglibs</artifactId>
<version>5.1.1.RELEASE</version>
</dependency>
<!-- Spring MVC support -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>5.1.2.RELEASE</version>
</dependency>
<!-- Servlet, JSP and JSTL support -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<!-- TO DO: Add support for Maven WAR Plugin -->
<build>
<finalName>spring-security-demo</finalName>
<pluginManagement>
<plugins>
<plugin>
<!-- Add Maven coordinates forL maven-war-plugin -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>10</source>
<target>10</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
The dependencies aren't being read in class files and also I've tried deleting .m2 repository and starting Eclipse and doing the : Maven->Clean, Maven->install, and than Maven->update project. Nothing helped. I'm really stuck here for about 2-3 hours now.
Note: in Windows->Preferences->installed JRE's the jre10 was marked with the tick. I changed it to mark the jdk10. but still error :
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project spring-security-demo-06-user-roles: Compilation failure
Everything was working fine until I added the dependency of : spring-security-taglibs.
Deleting the dependency doesn't do anything aswell.
Check properly settings with version of your project in eclipse and version of your runner for maven.
I have reproduced the same issue with maven-compiler plugin, but using version 3.8.1:
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project testName: Fatal error compiling
My POM was:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
To clarify:
in project I'm using Java 11 and IntelijIDEA (but logic I think the same for eclipse). So I'm using maven lifecycle phases fine only if my version of project (check properly Project Structure -> Project Settings) corresponds to version of maven runner.
E.g. if version of runner is for java 8, but project settings are for Java 11 then I'm getting this error. If I have the same for both then I don't have any problems.
And I highly recommend to check all settings for maven and the whole project. It helps to avoid the issues in the future. Deleting folder for maven is as alternative solution, but it must be last thing that you need to do.
It started working Automagically . FIX : delete .m2 repository.
I did that yesterday but it didn't help, today somehow, deleting the .m2 repository and updating the project helped !
Confirm, delete your entire local repository pointed to by .m2/settings.xml, usually this is .m2/repository
I updated my Java SDK to 11.9 and reloaded the project. With this I solved my problem.
I had the same issue, it was because the Spring Boot project was using Java 11 but my %JAVA_HOME% variable was pointing to Java 8 home directory. I resolved the issue by changing the path to %JAVA_HOME% variable.
You just need to go to preference(eclipse in this case) and change the right version of JDK like below in pic:
I have a dependency jReddit.jar in my local repo. When I build my project that has a reference to jReddit in it's pom, I keep getting error when server startup because it can't find jReddit.jar in the target web inf. I check the target web inf, and the jReddit is there, only its a folder and not a jar. It looks like 'jReddit.jar' but it is a folder not a jar. If I copy and paste the actual jar in my server it works, but I need it to build correctly. Inside my local repo the jReddit is there as a jar and looks normal.
I am not sure why this is happening because one day everything was working, then the next I can't build or deploy correctly.
<dependency>
<groupId>com.github.jreddit</groupId>
<artifactId>jreddit</artifactId>
<version>1.0.5</version>
</dependency>
I havent changed this since it broke, so I think its fine
whole pom
<?xml version="1.0" encoding="UTF-8"?>
<!--
JBoss, Home of Professional Open Source
Copyright 2013, Red Hat, Inc. and/or its affiliates, and individual
contributors by the #authors tag. See the copyright.txt in the
distribution for a full listing of individual contributors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<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.jreddit.service</groupId>
<artifactId>jRedditService</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>WildFly Quickstarts: jRedditService</name>
<description>A starter Java EE 7 webapp project for use on JBoss WildFly / WildFly, generated from the jboss-javaee6-webapp archetype</description>
<url>http://wildfly.org</url>
<licenses>
<license>
<name>Apache License, Version 2.0</name>
<distribution>repo</distribution>
<url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
</license>
</licenses>
<properties>
<!-- Explicitly declaring the source encoding eliminates the following
message: -->
<!-- [WARNING] Using platform encoding (UTF-8 actually) to copy filtered
resources, i.e. build is platform dependent! -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- JBoss dependency versions -->
<version.wildfly.maven.plugin>1.0.2.Final</version.wildfly.maven.plugin>
<!-- Define the version of the JBoss BOMs we want to import to specify
tested stacks. -->
<version.jboss.bom>8.2.1.Final</version.jboss.bom>
<!-- other plugin versions -->
<version.compiler.plugin>3.1</version.compiler.plugin>
<version.surefire.plugin>2.16</version.surefire.plugin>
<version.war.plugin>2.5</version.war.plugin>
<!-- maven-compiler-plugin -->
<maven.compiler.target>1.7</maven.compiler.target>
<maven.compiler.source>1.7</maven.compiler.source>
</properties>
<dependencyManagement>
<dependencies>
<!-- JBoss distributes a complete set of Java EE 7 APIs including a Bill
of Materials (BOM). A BOM specifies the versions of a "stack" (or a collection)
of artifacts. We use this here so that we always get the correct versions
of artifacts. Here we use the jboss-javaee-7.0-with-tools stack (you can
read this as the JBoss stack of the Java EE 7 APIs, with some extras tools
for your project, such as Arquillian for testing) and the jboss-javaee-7.0-with-hibernate
stack you can read this as the JBoss stack of the Java EE 7 APIs, with extras
from the Hibernate family of projects) -->
<dependency>
<groupId>org.wildfly.bom</groupId>
<artifactId>jboss-javaee-7.0-with-tools</artifactId>
<version>${version.jboss.bom}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.wildfly.bom</groupId>
<artifactId>jboss-javaee-7.0-with-hibernate</artifactId>
<version>${version.jboss.bom}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>com.github.jreddit</groupId>
<artifactId>jreddit</artifactId>
<version>1.0.5</version>
<!-- <scope>provided</scope> -->
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.5.4</version>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1</version>
</dependency>
<!-- First declare the APIs we depend on and need for compilation. All
of them are provided by JBoss WildFly -->
<!-- Import the CDI API, we use provided scope as the API is included in
JBoss WildFly -->
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
<scope>provided</scope>
</dependency>
<!-- Import the Common Annotations API (JSR-250), we use provided scope
as the API is included in JBoss WildFly -->
<dependency>
<groupId>org.jboss.spec.javax.annotation</groupId>
<artifactId>jboss-annotations-api_1.2_spec</artifactId>
<scope>provided</scope>
</dependency>
<!-- Import the JAX-RS API, we use provided scope as the API is included
in JBoss WildFly -->
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>jaxrs-api</artifactId>
<scope>provided</scope>
</dependency>
<!-- Import the JPA API, we use provided scope as the API is included in
JBoss WildFly -->
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.1-api</artifactId>
<scope>provided</scope>
</dependency>
<!-- Import the EJB API, we use provided scope as the API is included in
JBoss WildFly -->
<dependency>
<groupId>org.jboss.spec.javax.ejb</groupId>
<artifactId>jboss-ejb-api_3.2_spec</artifactId>
<scope>provided</scope>
</dependency>
<!-- JSR-303 (Bean Validation) Implementation -->
<!-- Provides portable constraints such as #Email -->
<!-- Hibernate Validator is shipped in JBoss WildFly -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Import the JSF API, we use provided scope as the API is included in
JBoss WildFly -->
<dependency>
<groupId>org.jboss.spec.javax.faces</groupId>
<artifactId>jboss-jsf-api_2.2_spec</artifactId>
<scope>provided</scope>
</dependency>
<!-- Now we declare any tools needed -->
<!-- Annotation processor to generate the JPA 2.0 metamodel classes for
typesafe criteria queries -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<scope>provided</scope>
</dependency>
<!-- Annotation processor that raising compilation errors whenever constraint
annotations are incorrectly used. -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator-annotation-processor</artifactId>
<scope>provided</scope>
</dependency>
<!-- Needed for running tests (you may also use TestNG) -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<!-- Optional, but highly recommended -->
<!-- Arquillian allows you to test enterprise code such as EJBs and Transactional(JTA)
JPA from JUnit/TestNG -->
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.protocol</groupId>
<artifactId>arquillian-protocol-servlet</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<!-- Maven will append the version to the finalName (which is the name
given to the generated war, and hence the context root) -->
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>org.jReddit.service.rest.JaxRsActivator</mainClass>
<classpathPrefix>dependency-jars/</classpathPrefix>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>${version.war.plugin}</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<archive>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
</archive>
</configuration>
</plugin>
<!-- The WildFly plugin deploys your war to a local WildFly container -->
<!-- To use, run: mvn package wildfly:deploy -->
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<version>${version.wildfly.maven.plugin}</version>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<!-- The default profile skips all tests, though you can tune it to run
just unit tests based on a custom pattern -->
<!-- Seperate profiles are provided for running all tests, including Arquillian
tests that execute in the specified container -->
<id>default</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${version.surefire.plugin}</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<!-- An optional Arquillian testing profile that executes tests
in your WildFly instance -->
<!--
This profile will start a new WildFly instance, and execute the
test, shutting it down when done -->
arq-wildfly-managed
org.wildfly
wildfly-arquillian-container-managed
test
<profile>
<!-- An optional Arquillian testing profile that executes tests
in a remote WildFly instance -->
<!-- Run with: mvn clean test -Parq-wildfly-remote -->
<id>arq-wildfly-remote</id>
<dependencies>
<dependency>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-arquillian-container-remote</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</profile>
</profiles>
this is relevant jReddits pom
<parent>
<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
<version>7</version>
</parent>
<groupId>com.github.jreddit</groupId>
<artifactId>jreddit</artifactId>
<version>1.0.5</version>
<name>jReddit</name>
<description>jReddit is a wrapper for the Reddit API written in Java. </description>
<url>https://github.com/karan/jReddit</url>
Imgur
I know this question was asked a long time ago, but since I had this problem, and I didn't find anything on Stackoverflow about this, I'll anwser myself.
Basically this happens when the project of the dependency, that you made the JAR file, is still open on your IDE.
That's because if you make changes on your dependecy you won't need to use the mvn package nor the mvn install, if you close your dependecy project you'll see that the folder will turn into the correctly JAR file as expected, and your main project will read the jar from your m2 folder.