Cannot use dependency jboss-javaee-6.0 in my Maven project - maven

I have set up a maven project with JBoss 7.1.1 and I want to use JavaEE libraries.
In the root pom.xml I have set:
<repositories>
<repository>
<id>jboss</id>
<url>https://repository.jboss.org/nexus/content/groups/public/</url>
</repository>
</repositories>
I have this in the root pom.xml and and in the ejb maven module´s pom.xml:
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-6.0</artifactId>
<version>3.0.2.Final</version>
<scope>provided</scope>
<type>pom</type>
</dependency>
When I do a maven clean install I get this error:
Failed to execute goal on project myproject-ejb: Could not resolve dependencies for project myproject:myproject-ejb:ejb:1.0-SNAPSHOT: Failure to find org.jboss.spec:jboss-javaee-6.0:jar:3.0.2.Final in https://repository.jboss.org/nexus/content/groups/public/ was cached in the local repository, resolution will not be reattempted until the update interval of jboss has elapsed or updates are forced -> [Help 1]
What´s up with my configuration?
EDIT 1
If I remove the jboss repository from the root pom.xml I get this error:
[ERROR] Failed to execute goal on project myproject-ejb: Could not resolve dependencies for project myproject:myproject-ejb:ejb:1.0-SNAPSHOT: The following artifacts could not be resolved: org.jboss.spec:jboss-javaee-6.0:jar:3.0.2.Final, xalan:xalan:jar:2.7.1.jbossorg-2: Could not find artifact org.jboss.spec:jboss-javaee-6.0:jar:3.0.2.Final in central (http://repo.maven.apache.org/maven2) -> [Help 1]

This is caused by a bug in Xalan POM file. The following workaround fixed the problem for me:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-6.0</artifactId>
<version>3.0.2.Final</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
<!-- Required by jboss-javaee-6.0:3.0.2.Final (https://issues.jboss.org/browse/JBBUILD-708) -->
<dependency>
<groupId>xalan</groupId>
<artifactId>xalan</artifactId>
<version>2.7.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
</dependencyManagement>

The given dependency for jboss-javaee-6.0 is available from Maven Central so there is no need to give a separate repository.
Based on the error message you need to delete a particular location from your location maven repository (usually in $HOME/.m2/repository) in this case the folder org/jboss/. Afterwards you need to rebuild your project.

This worked for me:
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-all-6.0</artifactId>
<version>3.0.2.Final</version>
<scope>provided</scope>
</dependency>
But I see here that something like the following may also work:
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-web-6.0</artifactId>
<version>2.0.0.Final</version>
<type>pom</type>
<scope>import</scope>
</dependency>

Related

Missing pom spring-boot-dependencies

There is a pom, pom.md5 and pom.shal missing for the latest version of the
spring-boot-dependencies.
http://repo.spring.io/snapshot/org/springframework/boot/spring-boot-dependencies/2.0.0.BUILD-SNAPSHOT/
Not quite sure if this is the right way - but could somebody put them there or change the maven-metadata.xml to point at the former Build?
Edit:
Error during build process
Failed to collect dependencies at org.springframework.statemachine:spring-statemachine-core:jar:2.0.0.BUILD-SNAPSHOT: Failed to read artifact descriptor for org.springframework.statemachine:spring-statemachine-core:jar:2.0.0.BUILD-SNAPSHOT: Could not find artifact org.springframework.boot:spring-boot-dependencies:pom:2.0.0.BUILD-20171005.042611-1 in spring.io.snapshot (http://repo.spring.io/snapshot) -> [Help 1]
Thanks
Edit2:
For the time being - until the issue is fixed - I did the following (not nice but works):
Excluded the spring-boot-dependencies in all the dependencies that have remotely something to do with spring boot.
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
</exclusion>
</exclusions>
Added the spring-boot-dependencies dependency from maven central.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.0.0.M3</version>
<type>pom</type>
<scope>import</scope>
</dependency>

How do I include javax.servlet servlet-api 3.0.1 in my Maven project?

I'm using Maven 3.3. Do I need to add any special repositories to access the servlet-api 3.0.1 jar? I've added this to my pom.xml file
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
but I get this error when I try and do a build ...
[ERROR] Failed to execute goal on project core: Could not resolve dependencies for project org.collegeboard.springboard:core:jar:99.0.0-SNAPSHOT: Could not find artifact javax.servlet:servlet-api:jar:3.0.1 in thirdparty (https://nexus.getmyco.com/nexus/content/repositories/thirdparty/) -> [Help 1]
I need this dependency because I'm told taht anoterh dependency (spring-test-4.0.6.RELEASE) requires this.
Look at the pom of spring-test-4.0.6.RELEASE: http://search.maven.org/#artifactdetails|org.springframework|spring-test|4.0.6.RELEASE|jar
It actually depends on the following:
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>

POM file for Camel

I am trying to compile the sample app for Camel and having problems with the POM file. The POM includes the following yet I am getting error (compile time) that the dependency is missing.
What am I missing here? Thanks!
<properties>
<camel.version>2.16.3</camel.version>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
<version>${camel.version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring</artifactId>
<version>${camel.version}</version>
</dependency>
</dependencies>
Update the repository (File->Settings->Build->Build Tools->Maven->Repositories->Update-Ok) and reimport the project into IntelliJ.
please add output which contains error.
Most probably, you could have problem with:
you forgot define repository
problem with proxy .m2/settings.xml
something bad with your firewall, try remove current artifact from .m2/repository/org/apache/camel
Try :
Right click project > Maven > Update Project (Select Force Update)

Why won't JBoss Resteasy maven dependency work?

I added
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs-all</artifactId>
<version>2.2.1.GA</version>
<scope>provided</scope>
</dependency>
and I'm using
<repositories>
<repository>
<id>jboss</id>
<url>http://repository.jboss.org/nexus/content/groups/public</url>
</repository>
</repositories>
When I try to build, I get the following error. What am I doing wrong?
[ERROR] Failed to execute goal on project tapvox-api: Could not resolve dependencies for project com.myproject.api:myproject-api:war:1.0-SNAPSHOT: Could not find artifact org.jboss.resteasy:resteasy-jaxrs-all:jar:2.2.1.GA in jboss (http://repository.jboss.org/nexus/content/groups/public) -> [Help 1]
The dependency that you are trying to download does not have any jars or transitive dependencies. Since the default type is jar, then this will fail. If you put
<type>pom</type>
in your dependency, then you get the only artifact that this dependency has to offer. See pom
I guess that you are trying to fetch the wrong dependency.
You have to specify a dependency type. Change your dependency to look like this:
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs-all</artifactId>
<version>2.2.1.GA</version>
<type>pom</type> <<<<<
<scope>provided</scope>
</dependency>

How to make maven versions:use-latest-versions step up import scoped entry in dependencyManagement?

We use the maven versions plugin to keep our versions up to date by regularly mvn versions:use-latest-versions. In our poms we have an import scoped dependency to another POM that looks like this:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>se.company.maven</groupId>
<artifactId>maven-third-party-dependencies</artifactId>
<version>0.0.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
When we run mvn versions:use-latest-versions all our dependencies (and other entries in dependencyManagement) get stepped up except this one. Is there a way to get the versions plugin to step up this kind of entry?
It does work when you put the version of the import-scoped dependency in a property, and use the versions:update-properties goal.
Your example pom would then look like this:
<properties>
<my.dependency.version>0.0.1</my.dependency.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>se.company.maven</groupId>
<artifactId>maven-third-party-dependencies</artifactId>
<version>${my.dependency.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
Could you be hitting one of the problems mentioned in the FAQ?
To rephrase it here, is the artifact which is not getting stepped a local artifact, which is not deployed to a repository manager? If so, you can resolve this by setting up a repository manager.

Resources