I have created and run a stand-alone Java program that logs via Log4j2 using Slf4j. The logging worked as expected.
I then added this functionality to an existing (and working) OpenShift Java web application that I am developing in an Eclipse IDE.
I added the following dependencies to pom.xml
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.21</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.7</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.7</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>2.7</version>
</dependency>
I used a simple log4j2.xml configuration file and added some logging code to a Java class.
I ran the web application locally and the logging worked fine.
I then moved pom.xml and log4j2.xml to the Git Staging Area and did a Commit and Push. This normally works fine and there are no problems.
This time I got the following error message in the dialog console window:
[ERROR] Failed to execute goal on project testdb: Could not resolve dependencies for project testdb:testdb:war:1.0: Failure to find org.apache.logging.log4j:log4j-api:jar:2.7 in http://maven.repository.redhat.com/techpreview/all was cached in the local repository, resolution will not be reattempted until the update interval of eap has elapsed or updates are forced -> [Help 1]
It seems to be saying that log4j-api version 2.7 is not available in the RedHat Maven Repository. But I am surely not the first person to do this, so I suspect there is some underlying error.
Any ideas? Any help would be much appreciated...
Hope this is timely and helpful. I was able to force an update and resolve this issue by deleting the invalid locally cached dependency in ~/.m2/repository/path/to/your/dependency on OpenShift, and then initiating another git push to trigger maven build.
I have the SAME PROBLEM with RedHat Maven Repository on my current project.
To esclude all possible problem due to code of my current project, I created a new project and applied to it a little update on index.html file (I simply added a space character).
Then, after a "git push" command, I obtained the same error on remote build phase, but this time with the download of basic plugin maven-clean-plugin :
remote: [ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.4.1
or one of its dependencies could not be resolved: Failed to read artifact
descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.4.1:
Failure to find org.apache.maven.plugins:maven-clean-plugin:pom:2.4.1 in
http://mirror.ops.rhcloud.com/nexus/content/groups/public was cached in the
local repository, resolution will not be reattempted until the update
interval of nexus has elapsed or updates are forced -> [Help 1]
It's clear that OPENSHIFT platform had some problem since today.
Yesterday, I tried this and it worked for me:
Create an empty file called force_clean_build inside application .openshift/markers directory. Commit the file and push the changes. This will remove the .m2 repository and download all the dependencies and plugins again.
Related
I have a problem when building a default project created by NetBeans when Maven-Java Web application is created. When I add Spring MVC dependency under Properties->Framework category and build a project I get this error:
Failure to find org.springframework:spring-framework-bom:jar:4.0.1.RELEASE in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
You have a placeholder in your local repo, try to delete this placeholder
delete the folder
~/.m2/repository/org/springframework/spring-framework-bom/4.0.1.RELEASE
Then rebuild with
mvn clean install -U
This assume your maven instillation is correct.
Did you add this dependency?
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId>
<version>4.0.1.RELEASE</version>
<type>pom</type>
</dependency>
and throws you that error? Could be a missed library.
Before adding it manually (or any other solution), make sure u really need the spring bom in your dependencies...
The bom should go under dependencyManagement section in your parent pom xml.
BTW the bom is only available as "POM" , not as "jar" scope.
I am trying to revive my old project. I want to use maven for it and I want to add AbsoluteLayout dependency. I am kinda new in maven so I have no idea what is wrong. I have found that this should work:
<dependency>
<groupId>org.netbeans.external</groupId>
<artifactId>AbsoluteLayout</artifactId>
<version>RELEASE802</version>
</dependency>
but I only get this error:
Failed to execute goal on project XXX: Could not resolve dependencies for project xx.xxxx:XXX:jar:1.0-SNAPSHOT: Failure to find org.netbeans.external:AbsoluteLayout:jar:RELEASE802 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
After this I manually added this dependency from my netbeans folder in my computer. And it is working. Is there another way how to add this dependency? I would like to include it in my pom file. Any ideas?
You need to add a Netbeans repository to your POM:
<repositories>
<repository>
<id>netbeans</id>
<name>Netbeans rep</name>
<url>http://bits.netbeans.org/maven2/</url>
</repository>
</repositories>
I added the below dependency block to my POM and after updating my maven indices it worked just fine.
<!-- https://mvnrepository.com/artifact/org.netbeans.external/AbsoluteLayout -->
<dependency>
<groupId>org.netbeans.external</groupId>
<artifactId>AbsoluteLayout</artifactId>
<version>RELEASE802</version>
</dependency>
So you might want to try updating your maven indices and see if that does it for you. This dependency block came directly from mvnrepository.com/, and worked without me needing to add any special repo as far as I'm aware.
Look like that dependency is not exists in the public repository, you can register an account and upload it, or, from my view point is better, you can setup your own private maven repository server, there many software support to do this, for example JFrog Artifactory, it is easy to install and manipulate.
I have to write a plug-in for Atlassian Confluence by using Atlassian SDK and and Java's SDK v8 on Eclipse IDE. Apache Maven (3.2.1) comes with Atlassian SDK which I have to use it from there (because there are a couple of dependencies that are shipped with the sdk that are not available in a maven repository); so I set the environment variables to point in there. Although, the POM file that I have to use comes with errors.
For example:
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.2-atlassian-1</version> <!-- 2.2.2 -->
</dependency>
<dependency>
<groupId>com.atlassian.confluence</groupId>
<artifactId>confluence</artifactId>
<version>${confluence.version}</version>
</dependency>
On both dependencies it says, missing artifact, e.g.,
Missing artifact com.atlassian.confluence:confluence:jar:5.8.10
Although, in both cases, for example:
com.google.code.gson
the jar file at m2 actualy exists, yet the error at the POM file notifies that the artifact is missing.
I tried the atlas-mvn clean package, even after wiping the m2 repository explicitelly, and rerunning that command though it did not resolve the problems.
Did any body come across such a problem?
I needed to take each the *.repositories file under specific artifact dir (which causes problems), and perform following modifications, for example:
maven-confluence-plugin-6.2.2.jar>atlassian-public=
Needs to appear in the following format:
maven-confluence-plugin-6.2.2.jar>=
And it's done!
I am working on a Java project, using maven as our dependency manager/build tool. I am currently having a problem resolving a dependency's dependency to the correct version.
The dependency in question is called jasperreports-functions-6.1.0.jar which is not hosted in a maven repo but provided in jar form.
The problem I'm having is that jasperreports-functions needs commons-lang 2.6. Inconveniently, during "compile" Maven itself builds commons-lang 2.1 to create the reduced-pom. It seems this leads to jasperreports-functions trying to use commons-lang 2.1 because it is available, but this is not valid (method undefined errors at runtime.)
I have tried adding commons-lang 2.6 as a dependency but still it seems jasperreports-functions is using the 2.1 version.
pom.xml snip:
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>6.1.0</version>
</dependency>
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports-functions</artifactId>
<version>6.1.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/jasperreports-functions-6.1.0.jar</systemPath>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
Using "mvn dependency:tree" I can see that no dependency requires commons-lang.
If I delete 2.1 from ".m2\repository\commons-lang\commons-lang" it gets recreated by maven. If I empty the folder and lock the permissions on it, then run maven again I get the error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:2.4:jar (default-jar) on project JavaLibrary: Execution default-jar of goal org.apache.maven.plugins:maven-jar-plugin:2.4:jar failed: Plugin org.apache.maven.plugins:maven-jar-plugin:2.4 or one of its dependencies could not be resolved: Failed to collect dependencies at org.apache.maven.plugins:maven-jar-plugin:jar:2.4 -> commons-lang:commons-lang:jar:2.1: Failed to read artifact descriptor for commons-lang:commons-lang:jar:2.1: Could not transfer artifact commons-lang:commons-lang:pom:2.1 from/to central (https://repo.maven.apache.org/maven2): C:\Users\Lowell\.m2\repository\commons-lang\commons-lang\2.1\commons-lang-2.1.pom.part.lock (Access is denied) -> [Help 1]
How can I force the jar dependency to use a certain version of a sub-dependency?
Have you tried to reorder the depency entries,
first to load commons-lang then to load jasperreports ?
Edit:
Maybe this should help you: dependency:analyze-dep-mgt
What you are doing should be enough. The newer version should override the older version AND the version you specify explicitly should override any transient dependency. I believe Maven 2.x had problems in this area which is why I updated to Maven 3.x
I suspect the problem is somewhere else. I suggest trying to delete common-lang 2.1 and I suspect this should show you what the real problem is.
Try this:
1> Maven clean.
2> Right click on project->maven -> update project configuration - > force update
I am trying to install the spring petcare application in my eclipse/tomcat7 installation, and I am getting the following error message when I try Run As..Maven Build in eclipse:
POM for joda-time:joda-time-jsptags:jar:1.0.2 is missing, no dependency information available
Here is a link to the complete stack trace. And here is a link to pom.xml. The entire code for the application can be found at this link. I have not changed anything in the application's code yet because I have not even gotten it to compile.
The jar in question seems to be in my local maven repository, so the problem may be that the app is simply not seeing it.
Can anyone help me get this to compile?
Actually looking at http://search.maven.org and the pom for that artifact is indeed missing! However the pom later version does exist.
Assuming that artifact is backward compatible I think you can fix it simply by upgrading joda-time-jsptags to 1.1.
Find and update following dependency on the pom.xml
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time-jsptags</artifactId>
<version>1.1</version>
<scope>runtime</scope>
</dependency>