Building a picketlink app - java

I like to build (mvn clean install) the picketlink example on
https://github.com/picketlink/TODO
But it wont work because the dependency picketlink-extension 3.0.0 isnt available in any repository.
Can anyone give me a hint what im doing wrong?

You could try to change
<dependency>
<groupId>org.picketlink.extensions</groupId>
<artifactId>picketlink-extensions-core</artifactId>
<version>3.0.0-SNAPSHOT</version>
</dependency>
to
<dependency>
<groupId>org.picketlink.extensions</groupId>
<artifactId>picketlink-extensions-core</artifactId>
<version>3.0.0-2013Feb08</version>
</dependency>
or anything newer from Maven Repository

Related

Maven using wrong dependency version

The dependency version I want to use is 4.5.0 as specified in my pom.xml
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
<version>4.5.0</version>
</dependency>
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna-platform</artifactId>
<version>4.5.0</version>
</dependency>
However, when I run mvn clean install -DskipTest=true. Maven will download and use version 4.2.2.
libraries
I tried searching in the entire project thinking maybe there are other files(in this case pom.xml) that specify the version to 4.2.2 but found nothing.
Has anybody encountered this issue before? I'm new to Java and I can't think of any other reason as to why this is happening.
Look at the output of mvn dependency:list. It will list you all dependencies of the project with their respective versions.
This is the truth. If your Eclipse or IntelliJ or whatever list something else, they are most certainly wrong/outdated.

How to solve "Could not find artifact javax.xml.ws:WebServiceContext" error when launching application with maven?

I am following this guide to build an application named [Entando][2].
Particularly I did the steps in 2.2 using the maven command to build the application
mvn archetype:generate -Dfilter=entando-archetype-webapp-generic
and it was successful.
Then to launch the application there is written to use the maven command
mvn clean jetty:run
At first I had the error described here but solved thanks to the answer there.
Now I am getting a similar error for javax.xml.ws:WebServiceContext:
I tried to modify the pom.xml file by adding:
<dependency>
<groupId>javax.xml.ws</groupId>
<artifactId>WebServiceContext</artifactId>
<version>2.2.11</version>
</dependency>
but it did not work resulting in the error:
Could not find artifact javax.xml.ws:WebServiceContext:jar:1.1.1 in snapshot-repository (https://oss.sonatype.org/content/repositories/snapshots/)
How can I solve it?
I found a solution, I will share it in case someone will need it:
In the pom.xml I added:
<dependency>
<groupId>javax.xml.ws</groupId>
<artifactId>jaxws-api</artifactId>
<version>2.2.6</version>
</dependency>
No need to add this javax.xml.ws dependency if you are using JDK 1.8 its rt.java already include this. If your JDK do not have rt.java ,just reconfigure it in your eclipse.
Add this dependency in your project-
<dependency>
<groupId>javax.xml.ws</groupId>
<artifactId>jaxws-api</artifactId>
<version>2.2.6</version>
</dependency>
and mvn clean install

Cannot import GraphDatabaseFactory

I am very new to Neo4j and I want to get started with an embedded Neo4j in a Java Application.
I try to create an HelloWorld Application like the following:
https://neo4j.com/docs/java-reference/current/#tutorials-java-embedded
You can find the source code here:
https://github.com/neo4j/neo4j/blob/3.1/manual/embedded-examples/src/main/java/org/neo4j/examples/EmbeddedNeo4j.java
I created a new maven project and added org.neo4j:neo4j 3.0.3 as a dependency. Unfortunately I cannot import "org.neo4j.graphdb.factory.GraphDatabaseFactory", all other imports seem to be ok.
Now I figured out, that the import is working for version "3.1.0-SNAPSHOT" of the neo4j dependency.
Here you can find the relevant part of my pom-file:
<dependencies>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j</artifactId>
<version>3.1.0-SNAPSHOT</version>
</dependency>
</dependencies>
Because I want to use a stable version, I want to achieve this with version 3.0.3 as well, but I cannot find something that this factory is depending on this version or how you should do it at version 3.0.3. Can somebody provide information about this?
The dependency you should include in your pom.xml is
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j</artifactId>
<version>3.0.3</version>
</dependency>
As I see you already included the right dependency. Then I guess something went wrong during the resolving. Therefore purge your local repository and resolve the dependency again with following command
mvn dependency:purge-local-repository -Dinclude=org.neo4j:neo4j
If it's still not working you have to check if you are resolving the artifact from the maven central repository or somewhere else.

Java EE Provided dependencies in Hudson / Jenkins

I'm trying to build a Maven based Java EE project on Jenkins, but I'm getting compilation errors. The reason seems to be that the Java EE dependencies that are marked as provided in the POM logically enough aren't downloaded when the project is built.
How can I set up the POM so that the build works in Jenkins, but the EE dependencies aren't included in the WAR file?
My thanks in advance for any input you can provide.
That's strange, AFAIK the dependencies with scope "provided" are simply not placed in the built file, they should however be downloaded. Are you sure your Maven is correctly configured to download dependencies - maybe there's a proxy that's not configured.
Not sure if its the best solution, but you can add EE dependencies with scope "provided", like the example:
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-servlet-api</artifactId>
<version>7.0.27</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.el</groupId>
<artifactId>javax.el-api</artifactId>
<version>2.2.4</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
Maybe there is a plugin who provides all of them to you, but I'm not sure about that.
Hope that helps

Maven error when resolving dependency

I am new to Maven and am trying to set up one of my first POMs. My application will cache using EhCache. Going to Maven Central Repo (link here) I copy-n-pasted the <dependency> tag and copy it into my pom.xml like so:
...many dependencies above this point
<dependency>
<scope>compile</scope>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>4.0.1.Final</version>
</dependency>
<dependency>
<scope>compile</scope>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
<version>2.5.0</version>
</dependency>
<dependency>
<scope>compile</scope>
<groupId>jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>3.5.3</version>
</dependency>
...many dependencies below this point
When I save the changes, Eclipse builds the workspace and gives me an error on the opening <dependency> tag for EhCache 2.5:
Missing artifact net.sf.ehcache:ehcache:jar:2.5.0
So I figured that perhaps v.2.5.0 has something wrong with it, and repeated the same for 2.4.7 (the last 2.4.x release before 2.5.0). Same deal.
Since I'm so new to Maven, I don't even know where to begin looking. I tried Project >> Clean and even restarted Eclipse to see if it was just a typical Eclipse "quirk". Nope.
I am thinking:
Could EhCache be publishing bad JARs to the Maven repo?
Could Maven Repo have something wrong with it?
Could this be due to something else configured wrong in my pom.xml?
Could this be a "JAR hell" issue where I have a conflict somewhere on my dependency graph?
How would SO start tackling this problem? Thanks in advance!
It is usually safer to refer to search.maven.org. Dependency from there:
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
<version>2.5.0</version>
<type>pom</type>
</dependency>
Mind type pom. From module's pom:
This is a pom artifact to pull in ehcache-core and ehcache-terracotta
for clustering. Make sure to set 'type' to 'pom' in your dependency.
Aparently when someone does not need terracotta, ehcache-core will do perfectly fine as other answer states.
They use ehcache-core in the official documentation. Maven Central does not have a jar artifact for ehcache 2.5 which explains your error message.
Using ehcache-core changes the dependency to:
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache-core</artifactId>
<version>2.5.0</version>
</dependency>
Which successfully downloads on my machine (ehcache does not).
I dropped this into IntelliJ and it found it. I suspect there is something wrong with your settings. Try creating a project with only this dependency in it. If it fails to download, I would check your setting. e.g. .m2/settings.xml Are you using a Nexus server or maven proxy/cache?
BTW: A simpler way to search for JARs is to use http://mvnrepository.com/ which will find all the available versions and show you the XML you need to add.

Categories

Resources