Banned Dependencies in Jboss Wildfly - maven

I'm working on migrating a legacy application from Jboss 6 to Wildfly 18. When I try to package up my application via maven I get the error:
[WARNING] Rule 0: org.apache.maven.plugins.enforcer.BannedDependencies failed with message:
Found Banned Dependency: javax.inject:javax.inject:jar:1
Found Banned Dependency: javax.activation:activation:jar:1.1
Found Banned Dependency: stax:stax-api:jar:1.0.1
Found Banned Dependency: org.slf4j:slf4j-log4j12:jar:1.7.25
Found Banned Dependency: com.sun.mail:javax.mail:jar:1.5.6
Found Banned Dependency: com.google.inject:guice:jar:4.2.3
Use 'mvn dependency:tree' to locate the source of the banned dependencies.
[WARNING] Rule 1: org.apache.maven.plugins.enforcer.DependencyConvergence failed with message:
Failed while enforcing releasability. See above detailed error message.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.775 s
[INFO] Finished at: 2020-10-22T12:50:47-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M2:enforce (ban-bad-dependencies) on project Common: Some Enforcer rules have failed. Look above for specific messages explaining why the rule failed.
Upon looking into this, my project does indeed have some dependencies on artifacts that are listed as 'Banned' by the maven-enforcer plugin in the wildfly pom. Some of the dependencies I have been able to work around, but there are others like Guice that would be very difficult to remove. I know I could override the enforcer settings in my own poms, but I don't want to do that without some idea of why they were blacklisted in the first place.
Dose anyone know where I can find documentation explaining why certain artifacts are blocked by wildfly? Has anyone tried using Guice with wildfly successfully?
Update:
the parent for my pom:
<parent>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-parent</artifactId>
<version>18.0.1.Final</version>
</parent>

Related

Dependency Graph in Spring Tool suite4 using Maven

I am working on resolving duplicate dependency issue. While solving I come to know that using dependency graph it will be easy. But I am not getting how to print a dependency Graph in STS4.
I have tried this command which I found in Maven Documentation
mvn dependency:tree -Dverbose -Dincludes=commons-collections
which is resulting :
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) # attache-ui-web ---
[WARNING] Invalid POM for com.apple.ist.msol.attache:attache-api-entity:jar:3.0.0-SNAPSHOT, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] Invalid POM for com.apple.ist.msol.attache:attache-api-entity:jar:3.0.0-SNAPSHOT, transitive dependencies (if any) will not be available, enable debug logging for more details
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.972 s
[INFO] Finished at: 2019-09-17T09:30:23+05:30
[INFO] ------------------------------------------------------------------------
Can someone explain what does this result exactly mean and how to get dependency tree ?
When you open the pom.xml file in Eclipse/STS3/STS4, there is a tab to list all the dependencies as well as a tab for the dependency hierarchy. It shows you all the dependencies that you declared in your project as root nodes and their transitive dependencies as sub-nodes.

JOOQ Plugin in Maven pom.xml file

I'm trying to build the example given on the official JOOQ git repo here. The maven pom.xml file contains the following plugin for JOOQ:
<plugin>
<groupId>org.jooq</groupId>
<artifactId>jooq-codegen-maven</artifactId>
<version>${org.jooq.version}</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<jdbc>
<driver>${db.driver}</driver>
<url>${db.url}</url>
<user>${db.username}</user>
<password>${db.password}</password>
</jdbc>
<generator>
<target>
<packageName>com.learnd.jooq.db</packageName>
<directory>src/main/java</directory>
</target>
</generator>
</configuration>
</execution>
</executions>
</plugin>
However I'm not managing to mvn compile, the project, and I'm getting the following output because of the${org.jooq.version} variable in the <version> tag. But whenever I've seen this plugin inserted, I've seen it done this way, even here.
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for org.jooq:jooq-spring-example:jar:3.10.0-SNAPSHOT
[WARNING] 'version' contains an expression but should be a constant. # org.jooq:jooq-spring-example:${org.jooq.version}, /home/lukec/Desktop/jOOQ-spring-example/pom.xml, line 8, column 14
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building jOOQ Spring Example 3.10.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for org.jooq:jooq-codegen-maven:jar:3.10.0-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.213 s
[INFO] Finished at: 2017-09-18T03:47:16+02:00
[INFO] Final Memory: 6M/150M
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.jooq:jooq-codegen-maven:3.10.0-SNAPSHOT or one of its dependencies could not be resolved: Could not find artifact org.jooq:jooq-codegen-maven:jar:3.10.0-SNAPSHOT -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
Can anyone help me with this? Cheers.
Its most likely because Maven cant find the jOOQ-codegen-maven 3.10.0-SNAPSHOT version in your local .m2. I checked the link from your question and I see the spring project and its dependent project jOOQ-codegen-maven in this link, https://github.com/jOOQ/jOOQ/blob/master/jOOQ-codegen-maven/pom.xml, so import this and build it, so that this version gets into your local .m2. And I see jOOQ-codegen-maven project has a parent jooq-parent, so you will probably need to build that as well for the dependencies to get resolved.
Once you have built and run jOOQ-codegen-maven and jooq-parent successfully, your local .m2 should have these dependencies, try building jooq-spring-example again and now the 3.10.0-SNAPSHOT dependencies should be resolved properly.
The above should most likely fix the issue but in case if it doesn't work, you could possibly try using the version from central, https://mvnrepository.com/artifact/org.jooq/jooq-codegen-maven/3.9.5 and see if that helps build your spring example.
There's no official release of 3.10.x jooq-codegen-maven plugin.
https://mvnrepository.com/artifact/org.jooq/jooq-codegen-maven
You should try using any one of them found in the above link.
I believe that the code gen 3.10.0-SNAPSHOT has yet to be released, along with the rest of the 3.10.0-SNAPSHOT.
If you need the functionality that has been developed and are comforatable using a library that has not been released yet,
git clone https://github.com/jOOQ/jOOQ
then run
mvn install
To build jooq 3.10.0-SNAPSHOT to your local repository. The example should run on your local machine. Beware that it will not work elsewhere (EX: jenkins machine).
If you do not feel comfortable using this unreleased code, use the latest published published published release version's example:
https://github.com/jOOQ/jOOQ/tree/version-3.9.0-branch/jOOQ-examples/jOOQ-spring-example
As the dependency graph expects 3.10.0-SNAPSHOT.

Maven Build Failure due Plugin Dependency

I've read the following previous answers to similar topics, but none have worked for me.
Here is what I've tried:
Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved
Maven Build Failure - failure to find plugins
The first link doesn't really apply because I'm not using a proxy, but I did check the settings.xml file for other possibilities. I can download directly by going to the plugin .jar file.
The second link might apply, but I have no idea what they mean by: "change user settings to point out to correct settings.xml and to your repository folder should exist in your system." I don't know how to do this and am not sure which repository they are referring to and how I find out. I'm looking only at my Maven settings.xml file.
So here's my errors
C:\cas-overlay-template-master>mvn package install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building cas-overlay 1.0
[INFO] ------------------------------------------------------------------------
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-compiler-plugin/3.3/maven-compiler-plugin-3.3.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.965 s
[INFO] Finished at: 2017-03-21T23:42:13-04:00
[INFO] Final Memory: 7M/97M
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.apache.maven.plugins:maven-compiler-plugin:3.3 or one of its dependencies could not be resolved: Could not transfer artifact org.apache.maven.plugins:maven-compiler-plugin:jar:3.3 from/to central (https://repo.maven.apache.org/maven2): java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
My goal is to get CAS 5.0.4 working for a Liferay 7.0ga3, running Tomcat 8, JDK 1.8, and Maven 3. I am a student, have never used any of these technologies except JDK 1.8, so I really need very understandable answers. Not veteran answers for those that should know what they are doing. Thanks
The actual problem here is around the certificates the Maven JVM is trusting:
Unexpected error: java.security.InvalidAlgorithmParameterException:
the trustAnchors parameter must be non-empty
Various things can fix it, but this question has a lot of solutions (and one more here).

Nexus Central local storage missing maven jars

I am currently using Nexus, but i'm pretty new to it.
I'm trying to build an EAR project and i'm getting the error below.
http://localhost:8080/nexus/content/groups/public is the default Public Group repository which includes Central, and within Central, the version 2.2.1 versions of the org.apache.maven artifacts are there remotely.
However, if i look at the local storage, it's not there, like the errors suggest.
I thought that during the build, it would update the local storage with the necessary files. I tried -U force updates already.
Any pointers are appreciated
John.
[INFO]
[INFO] --- maven-ear-plugin:2.10:generate-application-xml (default-generate-application-xml) # my-apps.ear ---
[WARNING] The POM for org.apache.maven:maven-project:jar:2.2.1 is missing, no dependency information available
[WARNING] The POM for org.apache.maven:maven-plugin-api:jar:2.2.1 is missing, no dependency information available
[WARNING] The POM for org.apache.maven:maven-artifact:jar:2.2.1 is missing, no dependency information available
[WARNING] The POM for org.apache.maven:maven-core:jar:2.2.1 is missing, no dependency information available
[WARNING] The POM for org.apache.maven:maven-archiver:jar:2.6 is missing, no dependency information available
[WARNING] The POM for org.codehaus.plexus:plexus-archiver:jar:2.9 is missing, no dependency information available
[WARNING] The POM for org.codehaus.plexus:plexus-utils:jar:3.0.20 is missing, no dependency information available
[WARNING] The POM for org.apache.maven.shared:maven-filtering:jar:1.3 is missing, no dependency information available
[WARNING] The POM for org.codehaus.plexus:plexus-interpolation:jar:1.22 is missing, no dependency information available
[WARNING] Failed to getClass for org.apache.maven.plugin.ear.GenerateApplicationXmlMojo
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.089 s
[INFO] Finished at: 2016-04-27T03:48:10+00:00
[INFO] Final Memory: 13M/107M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-ear-plugin:2.10:generate-application-xml (default-generate-application-xml) on project my-apps.ear: Execution default-generate-application-xml of goal org.apache.maven.plugins:maven-ear-plugin:2.10:generate-application-xml failed: Plugin org.apache.maven.plugins:maven-ear-plugin:2.10 or one of its dependencies could not be resolved: The following artifacts could not be resolved: org.apache.maven:maven-project:jar:2.2.1, org.apache.maven:maven-plugin-api:jar:2.2.1, org.apache.maven:maven-artifact:jar:2.2.1, org.apache.maven:maven-core:jar:2.2.1, org.apache.maven:maven-archiver:jar:2.6, org.codehaus.plexus:plexus-archiver:jar:2.9, org.codehaus.plexus:plexus-utils:jar:3.0.20, org.apache.maven.shared:maven-filtering:jar:1.3, org.codehaus.plexus:plexus-interpolation:jar:1.22: Failure to find org.apache.maven:maven-project:jar:2.2.1 in http://localhost:8080/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]

Failure to find com.oracle.state-management:state-management-parent:pom:1.0.0-SNAPSHOT

I can't remember what I did to cause this problem. When I try to run mvn clean install, I get the following output:
mvn clean install
[INFO] Scanning for projects...
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building search Maven Webapp 1.0
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for org.slf4j:slf4j-api:jar:12.1.2 is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.895 s
[INFO] Finished at: 2014-05-29T21:55:34+02:00
[INFO] Final Memory: 6M/154M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project search: Could not resolve dependencies for project com.ws:search:war:1.0: Failed to collect dependencies at com.oracle.weblogic:weblogic-server-pom:pom:12.1.2-0-0 -> com.oracle.weblogic:com.oracle.state-management.e
xecutor-internal-api_12.1.2:jar:12.1.2: Failed to read artifact descriptor for com.oracle.weblogic:com.oracle.state-management.executor-internal-api_12.1.2:jar:12.1.2: Failure to find com.oracle.state-management:state-management-parent:pom:1.0.0-SNAPSHOT in http://10.68
.20.32:8081/artifactory/libs-snapshot was cached in the local repository, resolution will not be reattempted until the update interval of snapshots has elapsed or updates are forced -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
The attempt to find com.oracle.state-management.executor-internal-api_12.1.2:jar:12.1.2 (Note the version: 12.1.2) fails because it originates from the dependency com.oracle.state-management.executor-internal-api_12.1.2 (version 12.1.2 too) while this dependency's pom has the following portion:
<parent>
<artifactId>state-management-parent</artifactId>
<groupId>com.oracle.state-management</groupId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../../parent/pom.xml</relativePath>
</parent>
What surprises me is that there is another version for this dependency (com.oracle.state-management.executor-internal-api_12.1.2) which is 12.1.2-0-0, I believe that this is the right version to refer to, not 12.1.2
What I think supports my assumption is that the output mentions that it failed to find sfl4j dependency with the version 12.1.2 !!
[WARNING] The POM for org.slf4j:slf4j-api:jar:12.1.2 is missing, no dependency information available
I refer to weblogic's dependency this way
<dependency>
<groupId>com.oracle.weblogic</groupId>
<artifactId>weblogic-server-pom</artifactId>
<version>12.1.2-0-0</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
How can I fix that ?
For some unearthly reason, weblogic's dependency
<dependency>
<groupId>com.oracle.weblogic</groupId>
<artifactId>weblogic-server-pom</artifactId>
<version>12.1.2-0-0</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
had the following version for it's dependencies
<dependency>
<groupId>com.oracle.weblogic</groupId>
<artifactId>weblogic</artifactId>
<version>[12.1.2,12.1.3)</version>
</dependency>
To resolve this, I replaced all [12.1.2,12.1.3) occurrences with 12.1.2-0-0 and now I can install my project again.
I would really appreciate it if someone tells me why was the POM generated this way ?!

Resources