Maven 'Missing artifact - maven

My local rpository is already has cxf-bundle-2.7.5.jar(download from search.maven.org by myself) and pom but eclipse still get a error 'Missing artifact org.apache.cxf:cxf-bundle:bundle:2.7.5' and when I update project repository make a file cxf-bundle-2.7.5.bundle.lastUpdated everytime. How could i fix this problem and why.
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-bundle</artifactId>
<version>2.7.5</version>
<type>bundle</type>
</dependency>
Thanks!!!

The simple answer is that the bundle is not really a bundle in the meaning of the type. If you take a look at search.maven.org you will see that there are jar, source, javadoc available so you need to change the dependency definition into the following:
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-bundle</artifactId>
<version>2.7.5</version>
</dependency>

Related

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)

Update all versions in maven

I've got a maven project with a large number of sub-projects with many dependencies. Now I'd like to update all versions of my pom files to a new version and rebuild them. For example if I've got a a pom like that:
<parent>
<groupId>theparentId</groupId>
<artifactId>theParentArtifact</artifactId>
<version>2.0</version>
<relativePath>..</relativePath>
</parent>
<artifactId>eaics-wsa-model</artifactId>
<packaging>model</packaging>
<dependencies>
<dependency>
<groupId>groupId1</groupId>
<artifactId>artifactId1</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>groupId2</groupId>
<artifactId>artifactId2</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>groupId3</groupId>
<artifactId>artifactId3</artifactId>
<version>1.3</version>
</dependency>
</dependencies>
I need to update the dependencies of groupId1 to groupId3 to a new version which doesn't exist jet. Because I also need to "create" a new updated version of my dependencies themself.
Because the dependencies in their pom.xml look like that at the moment:
<groupId>groupId3</groupId>
<artifactId>artifactId3</artifactId>
<version>1.2</version>
As you see, the version is on 1.2 but needs to be updated to 1.3 before the dependency uses it.
So is there a way to recursively update all pom (versions)? If it's possible in Java with MavenXpp3Reader etc. great. But is there a more simple method? Because my fear is, that I can't build my projects after that, because I think they don't build recursively and won't find the new dependency versions.
You can update all the pom's version using versions-maven-plugin There a some examples that can help you.

Why is cxf-rt-transports-http needed *twice* in a pom.xml

Adding the following snippet to my code:
Message message = PhaseInterceptorChain.getCurrentMessage();
HttpServletRequest request = (HttpServletRequest)message.get(AbstractHTTPDestination.HTTP_REQUEST);
request.getRemoteAddr();
Created a situation in which I had to add the following dependency (cxf.version is defined as 2.7.1):
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>${cxf.version}</version>
</dependency>
Although I already had earlier in my pom.xml the following:
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>${cxf.version}</version>
<type>jar</type>
<scope>runtime</scope>
</dependency>
If I don't add that later dependency, the project will not build, complaining "package org.apache.cxf.transport.http does not exist".
If I remove the earlier one (the one with <scope>runtime</scope>), the project will build successfully but the .war will fail to deploy with ClassNotFoundException: org.apache.cxf.endpoint.AbstractEndpointFactory.
Why are 2 occurrences of the same exact groupId/artifactId/version needed in the same pom.xml?
How do I clean/tidy up my pom.xml so that this package is only listed once?
Problem solved. For the benefit of all I am providing the solution.
All I did was to remove that apparent redundancy was to move the earlier one (i.e. with <type>jar</type>) down, replacing the second one and removing the <scope> line. Thus, remaining with only:
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>${cxf.version}</version>
<type>jar</type>
</dependency>
But further down the dependencies list.
It appears that the order of dependencies does matter (please correct if you know otherwise).

Maybe bad jasper report dependency in pom.xml

I'm developing my first application with vaadin and spring. I'm using also maven for dependency management. Now i have this trouble, when i try to add a the followed jasper report dependency
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>5.2.0</version>
</dependency>
I get the following error
The container 'Maven Dependencies' references non existing library 'C:\Users\Alex.m2\repository\bouncycastle\bcprov-jdk14\138\bcprov-jdk14-138.jar'
then i also try to add this dependency:
<dependency>
<groupId>bouncycastle</groupId>
<artifactId>bcmail-jdk14</artifactId>
<version>138</version>
</dependency>
but doesn't work.
Where i wrong?

MyFaces Commons Validator maven dependency repository

Seems like i am having a hard time finding the repository manager for this dependency:
<dependency>
<groupId>org.apache.myfaces.commons</groupId>
<artifactId>myfaces-commons</artifactId>
<version>1.1.2</version>
</dependency>
Can someone give me a hand on this :P
Found the problem.
The correct dependency should be:
<dependency>
<groupId>org.apache.myfaces.commons</groupId>
<artifactId>myfaces-validators20</artifactId>
<version>1.0.2</version>
</dependency>
This dependency can be found in Maven Central public repository:
http://search.maven.org/#artifactdetails%7Corg.apache.myfaces.commons%7Cmyfaces-validators20%7C1.0.2%7Cjar

Resources