Follow the instructions to build RL4J but error reported

Have followed the instructions to build RL4J from RL4J by the instruction:
mvn install
but it reported the following error:

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for rl4j 1.0.0-SNAPSHOT:
[INFO]
[INFO] rl4j … FAILURE [ 2.552 s]
[INFO] rl4j-api … SKIPPED
[INFO] rl4j-core … SKIPPED
[INFO] rl4j-gym … SKIPPED
[INFO] rl4j-doom … SKIPPED
[INFO] rl4j-ale … SKIPPED
[INFO] rl4j-malmo … SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.489 s
[INFO] Finished at: 2022-10-16T23:11:10+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:1.4.1:enforce (enforce-choice-of-nd4j-test-backend) on project rl4j: Some Enforcer rules have failed. Look above for specific messages explaining why the rule failed. → [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] MojoExecutionException - Apache Maven - Apache Software Foundation
What could be the cause? How to fix it? Thanks in advance!

Take a look further up in your log and look for “enforcer” or something like that, it will tell you exactly what the issue is.

Hi, dear treo. Thanks for your reply. The last debug output is something like:

[INFO] — maven-enforcer-plugin:1.4.1:enforce (enforce-choice-of-nd4j-test-backend) @ rl4j —
[DEBUG] Configuring mojo org.apache.maven.plugins:maven-enforcer-plugin:1.4.1:enforce from plugin realm ClassRealm[plugin>org.apache.maven.plugins:maven-enforcer-plugin:1.4.1, parent: jdk.internal.loader.ClassLoaders$AppClassLoader@6d5380c2]
[DEBUG] Configuring mojo ‘org.apache.maven.plugins:maven-enforcer-plugin:1.4.1:enforce’ with basic configurator →
[DEBUG] (s) fail = true
[DEBUG] (s) failFast = false
[DEBUG] (f) ignoreCache = false
[DEBUG] (f) mojoExecution = org.apache.maven.plugins:maven-enforcer-plugin:1.4.1:enforce {execution: enforce-choice-of-nd4j-test-backend}
[DEBUG] (s) project = MavenProject: org.deeplearning4j:rl4j:1.0.0-SNAPSHOT @ D:\deeplearning4j\rl4j\pom.xml
[DEBUG] (s) profiles = nd4j-tests-cpu,nd4j-tests-cuda
[DEBUG] (s) all = false
[DEBUG] (s) rules = [org.apache.maven.plugins.enforcer.RequireActiveProfile@e706aa]
[DEBUG] (s) session = org.apache.maven.execution.MavenSession@37baddde
[DEBUG] (s) skip = false
[DEBUG] – end configuration –
[DEBUG] Executing rule: org.apache.maven.plugins.enforcer.RequireActiveProfile
[DEBUG] Adding failure due to exception
org.apache.maven.enforcer.rule.api.EnforcerRuleException: Profile “nd4j-tests-cpu” is not activated.
Profile “nd4j-tests-cuda” is not activated.

  • at org.apache.maven.plugins.enforcer.RequireActiveProfile.execute (RequireActiveProfile.java:121)*
  • at org.apache.maven.plugins.enforcer.EnforceMojo.execute (EnforceMojo.java:193)*
  • at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)*
  • at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:370)*
  • at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:351)*
  • at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)*
  • at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:171)*
  • at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:163)*
  • at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)*
  • at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)*
  • at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)*
  • at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)*
  • at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:294)*
  • at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)*
  • at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)*
  • at org.apache.maven.cli.MavenCli.execute (MavenCli.java:960)*
  • at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)*
  • at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)*
  • at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)*
  • at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)*
  • at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)*
  • at java.lang.reflect.Method.invoke (Method.java:566)*
  • at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)*
  • at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)*
  • at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)*
  • at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)*
    [WARNING] Rule 0: org.apache.maven.plugins.enforcer.RequireActiveProfile failed with message:
    Profile “nd4j-tests-cpu” is not activated.
    Profile “nd4j-tests-cuda” is not activated.

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for rl4j 1.0.0-SNAPSHOT:
[INFO]
[INFO] rl4j … FAILURE [ 4.209 s]
[INFO] rl4j-api … SKIPPED
[INFO] rl4j-core … SKIPPED
[INFO] rl4j-gym … SKIPPED
[INFO] rl4j-doom … SKIPPED
[INFO] rl4j-ale … SKIPPED
[INFO] rl4j-malmo … SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.403 s
[INFO] Finished at: 2022-10-17T19:46:29+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:1.4.1:enforce (enforce-choice-of-nd4j-test-backend) on project rl4j: Some Enforcer rules have failed. Look above for specific messages explaining why the rule failed. → [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:1.4.1:enforce (enforce-choice-of-nd4j-test-backend) on project rl4j: Some Enforcer rules have failed. Look above for specific messages explaining why the rule failed.

  • at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:375)*
  • at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:351)*
  • at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)*
  • at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:171)*
  • at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:163)*
  • at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)*
  • at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)*
  • at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)*
  • at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)*
  • at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:294)*
  • at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)*
  • at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)*
  • at org.apache.maven.cli.MavenCli.execute (MavenCli.java:960)*
  • at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)*
  • at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)*
  • at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)*
  • at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)*
  • at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)*
  • at java.lang.reflect.Method.invoke (Method.java:566)*
  • at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)*
  • at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)*
  • at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)*
  • at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)*
    Caused by: org.apache.maven.plugin.MojoExecutionException: Some Enforcer rules have failed. Look above for specific messages explaining why the rule failed.
  • at org.apache.maven.plugins.enforcer.EnforceMojo.execute (EnforceMojo.java:237)*
  • at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)*
  • at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:370)*
  • at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:351)*
  • at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)*
  • at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:171)*
  • at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:163)*
  • at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)*
  • at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)*
  • at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)*
  • at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)*
  • at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:294)*
  • at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)*
  • at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)*
  • at org.apache.maven.cli.MavenCli.execute (MavenCli.java:960)*
  • at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)*
  • at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)*
  • at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)*
  • at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)*
  • at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)*
  • at java.lang.reflect.Method.invoke (Method.java:566)*
  • at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)*
  • at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)*
  • at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)*
  • at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)*
    [ERROR]
    [ERROR]
    [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1] MojoExecutionException - Apache Maven - Apache Software Foundation

How can I activate “nd4j-tests-cpu” and “nd4j-tests-cuda”? Thanks in advance!

It looks like you are building with tests enabled. Disable them with -DskipTests=true on the mvn command line.