Search code examples
mavendroolsremote-repository

Drools WorkBench Settings.xml add remote Repository


I'm getting the following error in drools workbench:

17:40:29,027 ERROR [stderr] (default task-11) javax.net.ssl|DEBUG|E4|default task-11|2022-05-23 17:40:29.027 UTC|SSLSocketImpl.java:1361|close the underlying socket
17:40:29,027 ERROR [stderr] (default task-11) javax.net.ssl|DEBUG|E4|default task-11|2022-05-23 17:40:29.027 UTC|SSLSocketImpl.java:1380|close the SSL connection (initiative)
17:40:29,030 INFO  [org.appformer.maven.integration.MavenRepository] (default task-11) Erasing directory from local maven repository /opt/jboss/.m2/repository/org/kie/kie-api/7.56.0.Final
17:40:29,031 ERROR [org.appformer.maven.integration.embedder.MavenProjectLoader] (default task-11) Unable to create MavenProject from InputStream: org.apache.maven.project.ProjectBuildingException: 1 problem was encountered while building the effective model
[FATAL] Non-readable POM : input contained no data @
 for project
       (...)
17:40:29,042 ERROR [org.kie.workbench.common.services.backend.builder.core.Builder] (default task-20) org.eclipse.aether.collection.DependencyCollectionException: Failed to read artifact descriptor for org.default:artifact:jar:1.0.0: java.lang.RuntimeException: org.eclipse.aether.collection.DependencyCollectionException: Failed to read artifact descriptor for org.default:artifact:jar:1.0.0
        (...)
Caused by: org.eclipse.aether.collection.DependencyCollectionException: Failed to read artifact descriptor for org.default:artifact:jar:1.0.0
        at deployment.business-central.war//org.eclipse.aether.internal.impl.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:208)
        at deployment.business-central.war//org.eclipse.aether.internal.impl.DefaultRepositorySystem.collectDependencies(DefaultRepositorySystem.java:316)
        at deployment.business-central.war//org.appformer.maven.integration.MavenRepository.getArtifactDependecies(MavenRepository.java:126)
        ... 99 more
Caused by: org.eclipse.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for org.default:artifact:jar:1.0.0
        at deployment.business-central.war//org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:282)
        at deployment.business-central.war//org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:198)
        at deployment.business-central.war//org.eclipse.aether.internal.impl.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:202)
        ... 101 more
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not transfer artifact org.default:artifact:pom:1.0.0 from/to central (https://repo1.maven.org/maven2/): Connection reset
        at deployment.business-central.war//org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:444)
        at deployment.business-central.war//org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:246)
        at deployment.business-central.war//org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:223)
        at deployment.business-central.war//org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:267)
        ... 103 more
Caused by: org.eclipse.aether.transfer.ArtifactTransferException: Could not transfer artifact org.default:artifact:pom:1.0.0 from/to central (https://repo1.maven.org/maven2/): Connection reset
        at deployment.business-central.war//org.eclipse.aether.connector.basic.ArtifactTransportListener.transferFailed(ArtifactTransportListener.java:43)
        at deployment.business-central.war//org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run(BasicRepositoryConnector.java:355)
        at deployment.business-central.war//org.eclipse.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:67)
        at deployment.business-central.war//org.eclipse.aether.connector.basic.BasicRepositoryConnector$DirectExecutor.execute(BasicRepositoryConnector.java:581)
        at deployment.business-central.war//org.eclipse.aether.connector.basic.BasicRepositoryConnector.get(BasicRepositoryConnector.java:249)
        at deployment.business-central.war//org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:520)
        at deployment.business-central.war//org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:421)
        ... 106 more
Caused by: javax.net.ssl.SSLException: Connection reset

I think the issue is that the project is trying to take out the dependencies from "repo1.maven.org" and "repo.maven.apache.org" when I need the project to download the dependencies from a my costum repository.

For that I followed this aproaches:

1. Add variables to JAVA_OPTS in startup:

-Dorg.guvnor.m2repo.dir=/opt/jboss/.m2/repository

-Dkie.maven.settings.custom=/opt/jboss/.m2/settings.xml

-Dorg.appformer.m2repo.url=https://scdvlcfs02.stc.com.sa/nexus/repository/celfocus-maven-group

2. Add the following lines to standalone-full.xml with JAVA_OPTS variable org.kie.workbench.profile=FULL

    <system-properties>
        <property name="org.guvnor.m2repo.dir" value="/opt/jboss/.m2/repository" />
        <property name="org.appformer.m2repo.url" value="https://scdvlcfs02.stc.com.sa/nexus/repository/celfocus-maven-group" />
        <property name="kie.maven.settings.custom" value="/opt/jboss/.m2/settings.xml" />
    </system-properties>

Of course I have also added the settings.xml in "/opt/jboss/.m2/settings.xml", with the following content:

<settings>
  <servers>
    <server>
      <id>drools-maven</id>
      <username>${env.KIE_MAVEN_REPO_USER}</username>
      <password>${env.KIE_MAVEN_REPO_PASSWORD}</password>
    </server>
  </servers>

  <profiles>
    <profile>
      <id>default</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <repositories>
        <repository>
          <id>drools-maven</id>
          <name>Drools Maven Repository</name>
          <url>${env.KIE_MAVEN_REPO}</url>
        
          <!-- Include these to always update the repository -->
          <releases>
            <updatePolicy>always</updatePolicy>
          </releases>
          <snapshots>
            <updatePolicy>always</updatePolicy>
          </snapshots>
        </repository>
      </repositories>
    </profile>
  </profiles>
</settings>

But still drools workbench continues to try to do the client handshake with "repo1.maven.org" and "repo.maven.apache.org". Any ideas?

I'm in this issue for a week and completely lost. Thanks in advance.


Solution

  • It seems that we cannot deny drools(jboss) to not look into Maven central.

    I mantained in settings xml the configurations for Maven central and my costum repository.

    Then I fixed this issue by putting in POM <scope>provided</scope> in all dependencies required to be dowloaded from my costum repository