OpenShift,Log4j2和Maven – 无法解决项目的依赖关系

我创建并运行了一个独立的Java程序,使用Slf4j通过Log4j2进行日志记录。 日志记录按预期工作。

然后,我将此function添加到我在Eclipse IDE中开发的现有(和工作) OpenShift Java Web应用程序中。

我将以下依赖项添加到pom.xml

 org.slf4j slf4j-api 1.7.21   org.apache.logging.log4j log4j-core 2.7   org.apache.logging.log4j log4j-api 2.7   org.apache.logging.log4j log4j-slf4j-impl 2.7  

我使用了一个简单的log4j2.xml配置文件,并在Java类中添加了一些日志代码。

我在本地运行Web应用程序,日志工作正常。

然后我将pom.xmllog4j2.xml移动到Git Staging Area并执行Commit和Push 。 这通常很好,没有问题。

这次我在对话框控制台窗口中收到以下错误消息:

 [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] 

似乎是说RedHat Maven资源库中没有log4j-api版本2.7 。 但我肯定不是第一个这样做的人,所以我怀疑存在一些潜在的错误。

有任何想法吗? 任何帮助将非常感激…

希望这是及时和有益的。 通过在OpenShift上删除〜/ .m2 / repository / path / to / your / dependency中的无效本地缓存依赖项,然后启动另一个git push来触发maven构建,我能够强制更新并解决此问题。

在我当前的项目中, 我有与RedHat Maven Repository相同的问题

为了解决由于当前项目的代码而导致的所有可能的问题,我创建了一个新项目,并在index.html文件上应用了一点点更新(我只是添加了一个空格字符)。 然后,在“ git push ”命令之后,我在远程构建阶段获得了相同的错误,但这次下载了基本的插件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] 

很明显,OPENSHIFT平台从今天起就出现了一些问题。

昨天,我尝试了这个,它对我有用:

在应用程序.openshift / markers目录中创建一个名为force_clean_build的空文件。 提交文件并推送更改。 这将删除.m2存储库并再次下载所有依赖项和插件。