1

I am having problem doing a build on a new project. The build works for the old devs on the project, but after cloning the projects and using the same version of maven. Its not working for me.

Initially, I was doing a mvn clean install

But, after some research I found out the same build error occured with a simple mvn clean.

The error is as follows:

C:\workspace\some-web-app>mvn clean
[INFO] Scanning for projects...
Downloading from nexus-public: https://company-net:8080/nexus/content/groups/public/org/jboss/bom/jboss-eap-javaee7-with-tools/7.1.0.GA/jboss-eap-javaee7-with-tools-7.1.0.GA.pom
Downloading from nexus-releases: https://company-net:8080/nexus/content/repositories/releases/org/jboss/bom/jboss-eap-javaee7-with-tools/7.1.0.GA/jboss-eap-javaee7-with-tools-7.1.0.GA.pom
Downloading from nexus-public: https://company-net:8080/nexus/content/groups/public/org/jboss/bom/eap-runtime-artifacts/7.1.0.GA/eap-runtime-artifacts-7.1.0.GA.pom
Downloading from nexus-releases: https://company-net:8080/nexus/content/repositories/releases/org/jboss/bom/eap-runtime-artifacts/7.1.0.GA/eap-runtime-artifacts-7.1.0.GA.pom
Downloading from nexus-public: https://company-net:8080/nexus/content/groups/public/org/jboss/spec/jboss-javaee-7.0/1.1.0.Final-redhat-1/jboss-javaee-7.0-1.1.0.Final-redhat-1.pom
Downloading from nexus-releases: https://company-net:8080/nexus/content/repositories/releases/org/jboss/spec/jboss-javaee-7.0/1.1.0.Final-redhat-1/jboss-javaee-7.0-1.1.0.Final-redhat-1.pom
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-ejb-plugin is missing. @ line 292, column 22
[ERROR] Non-resolvable import POM: Could not transfer artifact org.jboss.bom:jboss-eap-javaee7-with-tools:pom:7.1.0.GA from/to nexus-public (https://company-net:8080/nexus/content/groups/p
[ERROR] Non-resolvable import POM: Could not transfer artifact org.jboss.bom:eap-runtime-artifacts:pom:7.1.0.GA from/to nexus-public (https://company-net:8080/nexus/content/groups/public/)
[ERROR] Non-resolvable import POM: Could not transfer artifact org.jboss.spec:jboss-javaee-7.0:pom:1.1.0.Final-redhat-1 from/to nexus-public (https://company-net:8080/nexus/content/groups/
[ERROR] 'dependencies.dependency.version' for javax.enterprise:cdi-api:jar is missing. @ line 136, column 21
[ERROR] 'dependencies.dependency.version' for org.hibernate:hibernate-core:jar is missing. @ line 142, column 21
[ERROR] 'dependencies.dependency.version' for org.hibernate:hibernate-validator:jar is missing. @ line 148, column 21
[ERROR] 'dependencies.dependency.version' for org.hibernate:hibernate-ehcache:jar is missing. @ line 160, column 21
[ERROR] 'dependencies.dependency.version' for org.jboss.spec.javax.servlet:jboss-servlet-api_3.1_spec:jar is missing. @ line 165, column 21
[ERROR] 'dependencies.dependency.version' for org.jboss.spec.javax.faces:jboss-jsf-api_2.2_spec:jar is missing. @ line 171, column 21
[ERROR] 'dependencies.dependency.version' for org.jboss.spec.javax.ejb:jboss-ejb-api_3.2_spec:jar is missing. @ line 177, column 21

The settings.xml is under C:\Users[User-ID].m2 as follows:

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
    <pluginGroups />
    <proxies />
    <servers>

        <server>
          <id>nexus-public</id>
          <username>user1</username>
          <password>pass1</password>
        </server>
        <server>
          <id>nexus-snapshots</id>
          <username>user1</username>
          <password>pass1</password>
        </server>
        <server>
          <id>nexus-releases</id>
          <username>user1</username>
          <password>pass1</password>
        </server>

    </servers>

    <mirrors />

    <profiles>
        <profile>
            <id>companydev</id>

            <properties>
                <unit-test-ldap-server-host>mis-dev</unit-test-ldap-server-host>
                <unit-test-database-url>jdbc:mysql://mis-dev:1234/unit_test</unit-test-database-url>
            </properties>

            <repositories>
                <repository>
                    <id>nexus-public</id>
                    <url>https://company-net:8080/nexus/content/groups/public/</url>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <enabled>false</enabled>
                    </snapshots>
                </repository>
                <repository>
                    <id>nexus-snapshots</id>
                    <url>https://company-net:8080/nexus/content/repositories/snapshots</url>
                    <releases>
                        <enabled>false</enabled>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
                </repository>
                <repository>
                    <id>nexus-releases</id>
                    <url>https://company-net:8080/nexus/content/repositories/releases</url>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <enabled>false</enabled>
                    </snapshots>
                </repository>
            </repositories>
        </profile>
    </profiles>

    <activeProfiles>
        <activeProfile>companydev</activeProfile>
    </activeProfiles>

</settings>

The POM for the module to be build is:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>sc.foc.fo.plc</groupId>
    <artifactId>ams-parent</artifactId>
    <packaging>pom</packaging>
    <version>0.0.1-SNAPSHOT</version>

    <name>ags</name>
    <description>desc  .........</description>
    <organization>
        <name>Org Name</name>
    </organization>

    <distributionManagement>
        <repository>
            <id>deployment</id>
            <name>Internal Releases</name>
            <url>http://1.2.3.4:8081/nexus/content/repositories/releases/</url>
        </repository>
        <snapshotRepository>
            <id>deployment</id>
            <name>Internal Releases</name>
            <url>http://1.2.3.4:8081/nexus/content/repositories/snapshots/</url>
        </snapshotRepository>
    </distributionManagement>

    <properties>

        <!-- Explicitly declaring the source encoding eliminates the following
            message: [WARNING] Using platform encoding (UTF-8 actually) to copy
            filtered resources, i.e. build is platform dependent! -->
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <commons-lang.version>2.4</commons-lang.version>

        <deltaspike.version>1.8.0</deltaspike.version>

        <jboss-spec-javaee-7.0.version>1.1.0.Final-redhat-1</jboss-spec-javaee-7.0.version>
        <primefaces.version>6.1</primefaces.version>
        <server-bom.version>7.1.0.GA</server-bom.version>

        <!-- EAP7 version, according to https://stackoverflow.com/questions/38688392/slf4j-logging-with-jboss-wildfly-10 -->
        <slf4j.version>1.7.7</slf4j.version>
        <wildfly-maven-plugin.version>1.2.0.Alpha4</wildfly-maven-plugin.version>

        <commons-io.version>2.4</commons-io.version>

        <swagger-core-v3.version>2.0.2</swagger-core-v3.version>
        <swagger-model-v3.version>2.0.2</swagger-model-v3.version>
        <swagger-codegen-maven-plugin.version>2.3.1</swagger-codegen-maven-plugin.version>
        <swagger-core.version>1.5.16</swagger-core.version>

        <cxf-rt-frontend-jaxrs.version>3.1.12</cxf-rt-frontend-jaxrs.version>
        <cxf-version>3.1.11</cxf-version>

        <junit.version>4.12</junit.version>
        <mysql-connector.version>5.1.45</mysql-connector.version>

        <jackson-version>1.9.2</jackson-version>
        <jax-rs-version>1.1.1</jax-rs-version>
        <json4s-jackson-version>3.2.4</json4s-jackson-version>
        <json4s-core-version>3.0.0</json4s-core-version>
        <fasterxml-json-version>2.8.9</fasterxml-json-version>
        <scala-lang-version>2.9.1-1</scala-lang-version>
        <reflections-version>0.9.9-RC1</reflections-version>
        <javassist-version>3.16.1-GA</javassist-version>
        <paranamer-version>2.5.2</paranamer-version>
        <scannotation-version>1.0.3</scannotation-version>
        <swagger-version>1.5.1-M2</swagger-version>
        <resteasy-jaxrs-version>3.0.24.Final</resteasy-jaxrs-version>
        <javax-servlet-version>3.1.0</javax-servlet-version>
        <mockito.version>1.10.19</mockito.version>
        <slf4j.version>1.7.7</slf4j.version>

    </properties>

    <dependencyManagement>
        <dependencies>
            <!-- JBoss distributes a complete set of Java EE APIs including a Bill
                of Materials (BOM). A BOM specifies the versions of a "stack" (or a collection)
                of artifacts. We use this here so that we always get the correct versions
                of artifacts. Here we use the jboss-eap-javaee7-with-tools stack (you can
                read this as the JBoss stack of the Java EE APIs, with some extras tools
                for your project, such as Arquillian for testing) -->
            <dependency>
                <groupId>org.jboss.bom</groupId>
                <artifactId>jboss-eap-javaee7-with-tools</artifactId>
                <version>${server-bom.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <dependency>
                <groupId>org.jboss.bom</groupId>
                <artifactId>eap-runtime-artifacts</artifactId>
                <version>${server-bom.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <!-- Define the version of the JBoss Java EE APIs we want to use -->
            <!-- JBoss distributes a complete set of Java EE APIs including
               a Bill of Materials (BOM). A BOM specifies the versions of a "stack" (or
               a collection) of artifacts. We use this here so that we always get the correct
               versions of artifacts. Here we use the jboss-javaee-7.0 stack (you can
               read this as the JBoss stack of the Java EE APIs). You can actually
               use this stack with any version of JBoss EAP that implements Java EE. -->
            <dependency>
                <groupId>org.jboss.spec</groupId>
                <artifactId>jboss-javaee-7.0</artifactId>
                <version>${jboss-spec-javaee-7.0.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <dependency>
                <groupId>org.jboss.as</groupId>
                <artifactId>jboss-as-cli</artifactId>
                <version>7.2.0.Final</version>
                <exclusions>
                    <!-- we exclude this because it's locally resolved at runtime, yet the dependency plugin attempts to download it -->
                    <exclusion>
                        <groupId>sun.jdk</groupId>
                        <artifactId>jconsole</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>

        </dependencies>
    </dependencyManagement>

    <dependencies>

        <dependency>
            <groupId>javax.enterprise</groupId>
            <artifactId>cdi-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-ehcache</artifactId>
        </dependency>

        <dependency>
            <groupId>org.jboss.spec.javax.servlet</groupId>
            <artifactId>jboss-servlet-api_3.1_spec</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.jboss.spec.javax.faces</groupId>
            <artifactId>jboss-jsf-api_2.2_spec</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.jboss.spec.javax.ejb</groupId>
            <artifactId>jboss-ejb-api_3.2_spec</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.primefaces</groupId>
            <artifactId>primefaces</artifactId>
            <version>${primefaces.version}</version>
        </dependency>

        <dependency>
            <groupId>org.primefaces.themes</groupId>
            <artifactId>all-themes</artifactId>
            <version>1.0.10</version>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <scope>provided</scope>
            <version>${slf4j.version}</version>
            <artifactId>slf4j-api</artifactId>
        </dependency>

        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
            <version>${commons-lang.version}</version>
        </dependency>

        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>${commons-io.version}</version>
        </dependency>

        <!-- test -->

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
        </dependency>

        <dependency>
            <groupId>org.dbunit</groupId>
            <artifactId>dbunit</artifactId>
            <version>2.5.4</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>${mysql-connector.version}</version>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>nl.geodienstencentrum.maven</groupId>
                <artifactId>sass-maven-plugin</artifactId>
                <!-- Cannot use a later version! it uses classes that are incompatible
                     with the maven deploy plugin, and this can't be easily resolved
                     e.g. see https://stackoverflow.com/questions/43630262/how-to-exclude-a-direct-dependency-of-a-maven-plugin -->
                <version>2.25</version>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.3</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.4</version>
                <!--
                <configuration>
                    <systemProperties>
                        <property>
                            <name>unit-test-ldap-server-host</name>
                            <value>${unit-test-ldap-server-host}</value>
                        </property>
                        <property>
                            <name>unit-test-database-url</name>
                            <value>${unit-test-database-url}</value>
                        </property>
                    </systemProperties>
                </configuration>
                -->
            </plugin>

            <plugin>
                <artifactId>maven-install-plugin</artifactId>
                <version>2.4</version>
            </plugin>

            <!-- plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-ejb-plugin</artifactId>
                <configuration>
                    <ejbVersion>3.1</ejbVersion>
                </configuration>
            </plugin-->

           <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-ejb-plugin</artifactId>
                    <version>3.0.1</version>
                    <configuration>
                        <ejbVersion>3.0</ejbVersion>
                    </configuration>
            </plugin>


             <!--

            To be able to share a single suppression files, regardless of how
            maven is ran, we can't have this plugin running in the parent pom
            (it has a circular dependency on the build-tools module).

            Therefore, each module that should have dependencies checked
            should include this plugin

            !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
            Has been disabled temporarily as the suppression of vulnerabilities CVE-2017-7656, CVE-2017-7658, CVE-2017-7657 and
            CVE-2017-9735 do not work resulting in a Jenkins build failure.

            Developers should uncomment this section, change the phase to compile below and run a standard mvn clean install whenever new
            dependencies have been added in a pom to ensure that no further vulnerabilities are added or at least new suppressions are 
            added.
            !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

            -->
            <!--plugin>
                <groupId>org.owasp</groupId>
                <artifactId>dependency-check-maven</artifactId>
                <version>3.1.2</version>
                <executions>
                    <execution>
                        <phase>deploy</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <configuration>

                            <cveValidForHours>96</cveValidForHours>
                            <failBuildOnCVSS>7</failBuildOnCVSS>
                            <suppressionFile>build-tools/dep-check-supression.xml</suppressionFile>
                            <assemblyAnalyzerEnabled>false</assemblyAnalyzerEnabled>
                        </configuration>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>sc.foc.fo.plc</groupId>
                        <artifactId>ags-build-tools</artifactId>
                        <version>${project.version}</version>
                    </dependency>
                </dependencies>
            </plugin-->
        </plugins>
    </build>

    <modules>
        <module>ags-build-tools</module>
        <module>ags-core</module>
        <module>ags-core-api</module>
        <module>ags-jpa</module>
        <module>ags-integration-authorise-api</module>
        <module>ags-integration-authorise-api-impl</module>
        <module>ags-integration-jboss</module>
        <module>ags-database</module>
        <module>ags-web</module>
    </modules>

</project>

I'v added the latest version for the dependencies in the POM to hack d 7 errors related to "'dependencies.dependency.version' ". But, my colleagues did not have to add the version to theirs'. So, my hack is not acceptable! The dependency have a scope of 'provided' and should be provided by the container. After research, I learned the dependencies should be downloaded into my .m2 (local repo) for local build, but they should not be packaged into the final artefact during buld.

Also, the second issue which is still unresolved is the "Non-resolvable import POM: Could not transfer artifact". I am thinking its a proxy issue, but my colleagues reckon using my mobile hot spot should work. Any ideas will be appreciated. Thanks.

Any ideas what could possibly be the problem?

Mega
  • 1,304
  • 5
  • 22
  • 37

4 Answers4

0

You don't have this entry under your dependencyManagement likewise do it for all your dependencies. Version should be added either on dependencyManagement or directly under dependencies

<dependencyManagement>
    <dependency>
        <groupId>javax.enterprise</groupId>
        <artifactId>cdi-api</artifactId>
        <scope>provided</scope>
        <version>whatever-version-you-need</version>
    </dependency>
</dependencyManagement>
Jayesh
  • 983
  • 6
  • 16
  • Hello Jayesh and Ivan, I have added the latest version for the dependencies in the POM to resolve the 7 errors related to "'dependencies.dependency.version' ". But, my colleagues did not have to add the version to theirs'. – Mega Sep 01 '18 at 00:22
  • @olatom are you sure that your pom.xml is the same as your colleagues use? You have to set version for dependency either in `` or directly in `` – Ivan Sep 01 '18 at 00:30
  • Hi Pal, they did not set the version. The scope is provided as well. The code was checked out of the same repo. – Mega Sep 01 '18 at 00:34
  • GM, there are 2 problems. (1) error downloading dependencies from nexus.(2)The dependencies needing version for scope - provided. I ran "mvn clean -e" : Caused org.eclipse.aether.resolution.ArtifactResolutionException: Could not transfer artifact org.jboss.bom:eap-runtime-artifacts:pom:7.1.0.GA from/to nexus-public (company-net Caused by: org.apache.maven.wagon.TransferFailedException: Remote host closed connection during handshake Caused by: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake Caused by: java.io.EOFException: SSL peer shut down incorrectly – Mega Sep 01 '18 at 09:01
0

If old devs can build, and you cannot, that means that old devs have some artifacts in their local Maven cache/repository, and you don't. You probably need -Pcompanydev to look in the local repository manager.

bmargulies
  • 97,814
  • 39
  • 186
  • 310
  • Hi, if the devs have the artefacts in their m2, it was downloaded from nexus. Also, i ran mvn clean -e and the key error lines are : Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not transfer artifact org.jboss.bom:eap-runtime-artifacts:pom:7.1.0.GA from/to nexus-public (https://company-net Caused by: org.apache.maven.wagon.TransferFailedException: Remote host closed connection during handshake Caused by: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake Caused by: java.io.EOFException: SSL peer shut down incorrectly – Mega Sep 01 '18 at 00:48
  • If you do not put the profile on you command you will not talk to Nexus. – bmargulies Sep 01 '18 at 00:58
  • Thanks for your input bmargulies. Doing mvn build with the profile did not make any difference. I dont know what is different between our set up. – Mega Sep 01 '18 at 09:03
0

Thanks all, this got resolved by connecting to my home wifi (without company firewall, proxy etc), so I was able to progress further with downloading dependencies, but then I ran into another issue which I will raise a new question for. Thanks.

Mega
  • 1,304
  • 5
  • 22
  • 37
0

Thanks all for your contribution and time.

Problem was fixed by the support team white listing my machine and using corporate wifi. Similar issue could arise from corporate proxy blocking downloading dependencies from certain sites. You can update the proxy settings in your maven settings.xml.

Mega
  • 1,304
  • 5
  • 22
  • 37