Skip to content
This repository has been archived by the owner on Nov 25, 2024. It is now read-only.

Unable to build Spring Boot project #21

Open
MazeChaZer opened this issue Jan 2, 2020 · 2 comments
Open

Unable to build Spring Boot project #21

MazeChaZer opened this issue Jan 2, 2020 · 2 comments

Comments

@MazeChaZer
Copy link

I am trying to build a Spring Boot project using this Maven plugin and buildMaven. No matter what I do, I never get all the dependencies into the maven repository and the offline build fails.

$ nix-shell
[nix-shell]$ $buildPhase
[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM for de.pg626:webshop:0.0.1-SNAPSHOT: Cannot access central (https://repo.maven.apache.org/maven2) in offline mode and the artifact org.springframework.boot:spring-boot-starter-parent:pom:2.1.3.RELEASE has not been downloaded from it before. and 'parent.relativePath' points at no local POM @ line 5, column 13
 @ 
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]   
[ERROR]   The project de.pg626:webshop:0.0.1-SNAPSHOT (/home/jonas/tu/PG/gc/backend/pom.xml) has 1 error
[ERROR]     Non-resolvable parent POM for de.pg626:webshop:0.0.1-SNAPSHOT: Cannot access central (https://repo.maven.apache.org/maven2) in offline mode and the artifact org.springframework.boot:spring-boot-starter-parent:pom:2.1.3.RELEASE has not been downloaded from it before. and 'parent.relativePath' points at no local POM @ line 5, column 13 -> [Help 2]
[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/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException

Here is the pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.3.RELEASE</version>
        <relativePath />
        <!-- lookup parent from repository -->
    </parent>
    <groupId>de.pg626</groupId>
    <artifactId>webshop</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>webshop</name>
    <description>a social webshop</description>
    <properties>
        <java.version>1.8</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jersey</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.session</groupId>
            <artifactId>spring-session-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <dependency>
	        <groupId>org.springframework.boot</groupId>
	        <artifactId>spring-boot-starter-tomcat</artifactId>
		</dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.jsonwebtoken</groupId>
            <artifactId>jjwt</artifactId>
            <version>0.9.1</version>
        </dependency>
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
		  	<groupId>com.paypal.sdk</groupId>
		    <artifactId>rest-api-sdk</artifactId>
		    <version>1.14.0</version>		    
		</dependency>
		<dependency>
		    <groupId>com.paypal.sdk</groupId>
		    <artifactId>paypal-core</artifactId>
		    <version>1.7.2</version>
		</dependency>
		<dependency>
		    <groupId>com.paypal.sdk</groupId>
		    <artifactId>checkout-sdk</artifactId>
		    <version>1.0.0</version>
		</dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.flywaydb</groupId>
            <artifactId>flyway-core</artifactId>
            <version>5.2.4</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-mail</artifactId>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <includes>
                        <include>**/*_*.java</include>
                    </includes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.owasp</groupId>
                <artifactId>dependency-check-maven</artifactId>
                <version>5.0.0-M3</version>
                <configuration>
                    <failBuildOnCVSS>11</failBuildOnCVSS>
                    <format>JSON</format>
                    <jarAnalyzerEnabled>true</jarAnalyzerEnabled>
                    <nuspecAnalyzerEnabled>false</nuspecAnalyzerEnabled>
                    <archiveAnalyzerEnabled>false</archiveAnalyzerEnabled>
                    <centralAnalyzerEnabled>false</centralAnalyzerEnabled>
                    <ossindexAnalyzerEnabled>false</ossindexAnalyzerEnabled>
                    <nexusAnalyzerEnabled>false</nexusAnalyzerEnabled>
                    <artifactoryAnalyzerEnabled>false</artifactoryAnalyzerEnabled>
                    <pyDistributionAnalyzerEnabled>false</pyDistributionAnalyzerEnabled>
                    <pyPackageAnalyzerEnabled>false</pyPackageAnalyzerEnabled>
                    <rubygemsAnalyzerEnabled>false</rubygemsAnalyzerEnabled>
                    <opensslAnalyzerEnabled>false</opensslAnalyzerEnabled>
                    <cmakeAnalyzerEnabled>false</cmakeAnalyzerEnabled>
                    <autoconfAnalyzerEnabled>false</autoconfAnalyzerEnabled>
                    <composerAnalyzerEnabled>false</composerAnalyzerEnabled>
                    <nodeAnalyzerEnabled>false</nodeAnalyzerEnabled>
                    <retireJsAnalyzerEnabled>false</retireJsAnalyzerEnabled>
                    <nugetconfAnalyzerEnabled>false</nugetconfAnalyzerEnabled>
                    <cocoapodsAnalyzerEnabled>false</cocoapodsAnalyzerEnabled>
                    <bundleAuditAnalyzerEnabled>false</bundleAuditAnalyzerEnabled>
                    <!--> Gitlab CI-Server will add                    <dataDirectory></dataDirectory> Node here -->
                    <!--> Gitlab CI-Server will add                    <autoUpdate>false</autoUpdate> Node here -->
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

I generate the project-info.json with the following command:

$ mvn -Dmaven.repo.local=$(mktemp -d -t mavenXXX) org.nixos.mvn2nix:mvn2nix-maven-plugin:mvn2nix

My default.nix:

with import <nixpkgs> { };
(buildMaven ./project-info.json).build

It seems to me that the cause of the problem is the <parent> definition, I tried removing it but configuring all that Spring stuff by oneself is very complicated, I didn't figure out yet how to do that. And I'm not sure if I really want to do that :/ Any pointers or tips on how to debug this better are appreciated :)

@jerith666
Copy link
Contributor

NixOS/nixpkgs#19741 has some pointers that may be helpful.

@zeratax
Copy link

zeratax commented Nov 8, 2022

kinda frustrating that the official nixos documentation link to this project that seems clearly broken?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants