Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spring-boot-thin-maven-plugin doesn't work with my maven nexus setup #201

Open
ahoehma opened this issue Jul 30, 2023 · 1 comment
Open

Comments

@ahoehma
Copy link

ahoehma commented Jul 30, 2023

Hi all,

I tried the thin-launcher experiment but I found that behind my company maven/nexus setup it doesn't work,

In my worker environment I don't have direct access to maven central etc. All the maven traffic goes to our internal nexus-server.

So have this maven settings:

<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">
  <mirrors>
    <mirror>
      <id>nexus</id>
      <mirrorOf>*</mirrorOf>
      <url>https://internal-server/nexus/repository/public/</url>
    </mirror>
  </mirrors>
  <profiles>
    <profile>
      <id>myproject</id>
      <properties>
        <release-server-url>https://internal-server/nexus/content/repositories/releases/</release-server-url>
        <snapshot-server-url>https://internal-server/nexus/content/repositories/snapshots/</snapshot-server-url>
      </properties>
      <repositories>
        <repository>
          <id>nexus</id>
          <url>http://nexus</url>
          <releases>
            <enabled>true</enabled>
            <updatePolicy>never</updatePolicy>
          </releases>
          <snapshots>
            <enabled>true</enabled>
            <updatePolicy>always</updatePolicy>
          </snapshots>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>nexus</id>
          <url>http://nexus</url>
          <releases>
            <enabled>true</enabled>
            <updatePolicy>never</updatePolicy>
          </releases>
          <snapshots>
            <enabled>true</enabled>
            <updatePolicy>always</updatePolicy>
          </snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  </profiles>
  <servers>
    <server>
      <id>nexus</id>
      <username>XXXXX</username>
      <password>XXXXX</password>
    </server>
  </servers>
</settings>

For all my normal maven builds etc. everything works fine since years (I can just hope the above settings are not nonsense!) 😄

I added the plugin:

<plugin>
   <groupId>org.springframework.boot.experimental</groupId>
   <artifactId>spring-boot-thin-maven-plugin</artifactId>
   <version>1.0.30.RELEASE</version>
   <executions>
      <execution>
          <!-- Download the dependencies at build time -->
          <id>resolve</id>
          <goals>
              <goal>resolve</goal>
          </goals>
          <inherited>false</inherited>
       </execution>
   </executions>
</plugin>

I pimpt the final name of my app:

<properties>
    <finalName>ccupdate</finalName>
</properties>
<build>
    <finalName>${finalName}</finalName>
....

The I run simply "mvn clean install"

And for me it seems that the maven artifact downloader can't handle my "nexus" thing somehow:

[INFO] --- spring-boot-thin:1.0.30.RELEASE:resolve (resolve) @ update-service ---
[INFO] Deploying: D:\Dev\git\coc\spice-configuration-cluster\update-service\target\ccupdate.jar
[INFO] Copying: ccupdate.jar to D:\Dev\git\coc\spice-configuration-cluster\update-service\target\thin\root
Exception in thread "main" java.lang.IllegalStateException: Cannot build model
        at org.springframework.boot.loader.thin.DependencyResolver.dependencies(DependencyResolver.java:254)
        at org.springframework.boot.loader.thin.PathResolver.extract(PathResolver.java:265)
        at org.springframework.boot.loader.thin.PathResolver.resolve(PathResolver.java:111)
        at org.springframework.boot.loader.thin.ThinJarLauncher.getClassPathArchives(ThinJarLauncher.java:393)
        at org.springframework.boot.loader.thin.ThinJarLauncher.launch(ThinJarLauncher.java:215)
        at org.springframework.boot.loader.thin.ThinJarLauncher.main(ThinJarLauncher.java:168)
Caused by: hidden.org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs:
[ERROR] Non-resolvable import POM: Could not transfer artifact com.fasterxml.jackson:jackson-bom:pom:2.8.6 from/to nexus (http://nexus): nexus @ org.springframework.boot:spring-boot-dependencies:1.5.1.RELEASE, D:\Dev\git\coc\spice-configuration-cluster\update-service\target\thin\root\repository\org\springframework\boot\spring-boot-dependencies\1.5.1.RELEASE\spring-boot-dependencies-1.5.1.RELEASE.pom, line 621, column 16
[ERROR] Non-resolvable import POM: Could not transfer artifact org.springframework:spring-framework-bom:pom:4.3.6.RELEASE from/to nexus (http://nexus): nexus @ org.springframework.boot:spring-boot-dependencies:1.5.1.RELEASE, D:\Dev\git\coc\spice-configuration-cluster\update-service\target\thin\root\repository\org\springframework\boot\spring-boot-dependencies\1.5.1.RELEASE\spring-boot-dependencies-1.5.1.RELEASE.pom, line 2014, column 16
[ERROR] Non-resolvable import POM: Could not transfer artifact org.springframework.data:spring-data-releasetrain:pom:Ingalls-RELEASE from/to nexus (http://nexus): nexus @ org.springframework.boot:spring-boot-dependencies:1.5.1.RELEASE, D:\Dev\git\coc\spice-configuration-cluster\update-service\target\thin\root\repository\org\springframework\boot\spring-boot-dependencies\1.5.1.RELEASE\spring-boot-dependencies-1.5.1.RELEASE.pom, line 2087, column 16
[ERROR] Non-resolvable import POM: Could not transfer artifact org.springframework.integration:spring-integration-bom:pom:4.3.7.RELEASE from/to nexus (http://nexus): nexus @ org.springframework.boot:spring-boot-dependencies:1.5.1.RELEASE, D:\Dev\git\coc\spice-configuration-cluster\update-service\target\thin\root\repository\org\springframework\boot\spring-boot-dependencies\1.5.1.RELEASE\spring-boot-dependencies-1.5.1.RELEASE.pom, line 2109, column 16
[ERROR] Non-resolvable import POM: Could not transfer artifact org.springframework.security:spring-security-bom:pom:4.2.1.RELEASE from/to nexus (http://nexus): nexus @ org.springframework.boot:spring-boot-dependencies:1.5.1.RELEASE, D:\Dev\git\coc\spice-configuration-cluster\update-service\target\thin\root\repository\org\springframework\boot\spring-boot-dependencies\1.5.1.RELEASE\spring-boot-dependencies-1.5.1.RELEASE.pom, line 2201, column 16

        at hidden.org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:192)
        at hidden.org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:123)
        at org.springframework.boot.loader.thin.DependencyResolver.dependencies(DependencyResolver.java:213)
        ... 5 more
Caused by: hidden.org.apache.maven.model.building.ModelBuildingException: 5 problems were encountered while building the effective model for com.example:empty:0.0.1-SNAPSHOT
[ERROR] Non-resolvable import POM: Could not transfer artifact com.fasterxml.jackson:jackson-bom:pom:2.8.6 from/to nexus (http://nexus): nexus @ org.springframework.boot:spring-boot-dependencies:1.5.1.RELEASE, D:\Dev\git\coc\spice-configuration-cluster\update-service\target\thin\root\repository\org\springframework\boot\spring-boot-dependencies\1.5.1.RELEASE\spring-boot-dependencies-1.5.1.RELEASE.pom, line 621, column 16
[ERROR] Non-resolvable import POM: Could not transfer artifact org.springframework:spring-framework-bom:pom:4.3.6.RELEASE from/to nexus (http://nexus): nexus @ org.springframework.boot:spring-boot-dependencies:1.5.1.RELEASE, D:\Dev\git\coc\spice-configuration-cluster\update-service\target\thin\root\repository\org\springframework\boot\spring-boot-dependencies\1.5.1.RELEASE\spring-boot-dependencies-1.5.1.RELEASE.pom, line 2014, column 16
[ERROR] Non-resolvable import POM: Could not transfer artifact org.springframework.data:spring-data-releasetrain:pom:Ingalls-RELEASE from/to nexus (http://nexus): nexus @ org.springframework.boot:spring-boot-dependencies:1.5.1.RELEASE, D:\Dev\git\coc\spice-configuration-cluster\update-service\target\thin\root\repository\org\springframework\boot\spring-boot-dependencies\1.5.1.RELEASE\spring-boot-dependencies-1.5.1.RELEASE.pom, line 2087, column 16
[ERROR] Non-resolvable import POM: Could not transfer artifact org.springframework.integration:spring-integration-bom:pom:4.3.7.RELEASE from/to nexus (http://nexus): nexus @ org.springframework.boot:spring-boot-dependencies:1.5.1.RELEASE, D:\Dev\git\coc\spice-configuration-cluster\update-service\target\thin\root\repository\org\springframework\boot\spring-boot-dependencies\1.5.1.RELEASE\spring-boot-dependencies-1.5.1.RELEASE.pom, line 2109, column 16
[ERROR] Non-resolvable import POM: Could not transfer artifact org.springframework.security:spring-security-bom:pom:4.2.1.RELEASE from/to nexus (http://nexus): nexus @ org.springframework.boot:spring-boot-dependencies:1.5.1.RELEASE, D:\Dev\git\coc\spice-configuration-cluster\update-service\target\thin\root\repository\org\springframework\boot\spring-boot-dependencies\1.5.1.RELEASE\spring-boot-dependencies-1.5.1.RELEASE.pom, line 2201, column 16

        at hidden.org.apache.maven.model.building.DefaultModelProblemCollector.newModelBuildingException(DefaultModelProblemCollector.java:197)
        at hidden.org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:482)
        at hidden.org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:424)
        at hidden.org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:414)
        at hidden.org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:158)

I'm using

$mvn -version
Apache Maven 3.9.2 (c9616018c7a021c1c39be70fb2843d6f5f9b8a1c)
Maven home: D:\Dev\ApacheMaven\current-maven
Java version: 17.0.4, vendor: Oracle Corporation, runtime: D:\Dev\Java\jdk-17.0.4
Default locale: de_DE, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

I also tried with these maven settings:

<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">
  <mirrors>
    <mirror>
      <id>nexus</id>
      <mirrorOf>*</mirrorOf>
      <url>https://internal-server/nexus/repository/public/</url>
    </mirror>
  </mirrors>
  <profiles>
    <profile>
      <id>myproject</id>
      <properties>
        <release-server-url>https://internal-server/nexus/content/repositories/releases/</release-server-url>
        <snapshot-server-url>https://internal-server/nexus/content/repositories/snapshots/</snapshot-server-url>
      </properties>
      <repositories>
        <repository>
          <id>nexus</id>
          <url>https://internal-server/nexus/repository/public/</url>
          <releases>
            <enabled>true</enabled>
            <updatePolicy>never</updatePolicy>
          </releases>
          <snapshots>
            <enabled>true</enabled>
            <updatePolicy>always</updatePolicy>
          </snapshots>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>nexus</id>
          <url>https://internal-server/nexus/repository/public/</url>
          <releases>
            <enabled>true</enabled>
            <updatePolicy>never</updatePolicy>
          </releases>
          <snapshots>
            <enabled>true</enabled>
            <updatePolicy>always</updatePolicy>
          </snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  </profiles>
  <servers>
    <server>
      <id>nexus</id>
      <username>XXXXX</username>
      <password>XXXXX</password>
    </server>
  </servers>
</settings>

Then I get 401

[INFO] --- spring-boot-thin:1.0.30.RELEASE:resolve (resolve) @ update-service ---
[INFO] Deploying: D:\Dev\git\coc\spice-configuration-cluster\update-service\target\ccupdate.jar
[INFO] Copying: ccupdate.jar to D:\Dev\git\coc\spice-configuration-cluster\update-service\target\thin\root
Exception in thread "main" java.lang.IllegalStateException: Cannot build model
        at org.springframework.boot.loader.thin.DependencyResolver.dependencies(DependencyResolver.java:254)
        at org.springframework.boot.loader.thin.PathResolver.extract(PathResolver.java:265)
        at org.springframework.boot.loader.thin.PathResolver.resolve(PathResolver.java:111)
        at org.springframework.boot.loader.thin.ThinJarLauncher.getClassPathArchives(ThinJarLauncher.java:393)
        at org.springframework.boot.loader.thin.ThinJarLauncher.launch(ThinJarLauncher.java:215)
        at org.springframework.boot.loader.thin.ThinJarLauncher.main(ThinJarLauncher.java:168)
Caused by: hidden.org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs:
[ERROR] Non-resolvable import POM: Could not transfer artifact com.fasterxml.jackson:jackson-bom:pom:2.8.6 from/to nexus-foo (https://internal-server/nexus/repository/public/): status code: 401, reason phrase: Unauthorized (401) @ org.springframework.boot:spring-boot-dependencies:1.5.1.RELEASE, D:\Dev\git\coc\spice-configuration-cluster\update-service\target\thin\root\repository\org\springframework\boot\spring-boot-dependencies\1.5.1.RELEASE\spring-boot-dependencies-1.5.1.RELEASE.pom, line 621, column 16
[ERROR] Non-resolvable import POM: Could not transfer artifact org.springframework:spring-framework-bom:pom:4.3.6.RELEASE from/to nexus-foo (https://internal-server/nexus/repository/public/): status code: 401, reason phrase: Unauthorized (401) @ org.springframework.boot:spring-boot-dependencies:1.5.1.RELEASE, D:\Dev\git\coc\spice-configuration-cluster\update-service\target\thin\root\repository\org\springframework\boot\spring-boot-dependencies\1.5.1.RELEASE\spring-boot-dependencies-1.5.1.RELEASE.pom, line 2014, column 16
[ERROR] Non-resolvable import POM: Could not transfer artifact org.springframework.data:spring-data-releasetrain:pom:Ingalls-RELEASE from/to nexus-foo (https://internal-server/nexus/repository/public/): status code: 401, reason phrase: Unauthorized (401) @ org.springframework.boot:spring-boot-dependencies:1.5.1.RELEASE, D:\Dev\git\coc\spice-configuration-cluster\update-service\target\thin\root\repository\org\springframework\boot\spring-boot-dependencies\1.5.1.RELEASE\spring-boot-dependencies-1.5.1.RELEASE.pom, line 2087, column 16
[ERROR] Non-resolvable import POM: Could not transfer artifact org.springframework.integration:spring-integration-bom:pom:4.3.7.RELEASE from/to nexus-foo (https://internal-server/nexus/repository/public/): status code: 401, reason phrase: Unauthorized (401) @ org.springframework.boot:spring-boot-dependencies:1.5.1.RELEASE, D:\Dev\git\coc\spice-configuration-cluster\update-service\target\thin\root\repository\org\springframework\boot\spring-boot-dependencies\1.5.1.RELEASE\spring-boot-dependencies-1.5.1.RELEASE.pom, line 2109, column 16
[ERROR] Non-resolvable import POM: Could not transfer artifact org.springframework.security:spring-security-bom:pom:4.2.1.RELEASE from/to nexus-foo (https://internal-server/nexus/repository/public/): status code: 401, reason phrase: Unauthorized (401) @ org.springframework.boot:spring-boot-dependencies:1.5.1.RELEASE, D:\Dev\git\coc\spice-configuration-cluster\update-service\target\thin\root\repository\org\springframework\boot\spring-boot-dependencies\1.5.1.RELEASE\spring-boot-dependencies-1.5.1.RELEASE.pom, line 2201, column 16

        at hidden.org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:192)
        at hidden.org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:123)
        at org.springframework.boot.loader.thin.DependencyResolver.dependencies(DependencyResolver.java:213)
        ... 5 more
Caused by: hidden.org.apache.maven.model.building.ModelBuildingException: 5 problems were encountered while building the effective model for com.example:empty:0.0.1-SNAPSHOT
[ERROR] Non-resolvable import POM: Could not transfer artifact com.fasterxml.jackson:jackson-bom:pom:2.8.6 from/to nexus-foo (https://internal-server/nexus/repository/public/): status code: 401, reason phrase: Unauthorized (401) @ org.springframework.boot:spring-boot-dependencies:1.5.1.RELEASE, D:\Dev\git\coc\spice-configuration-cluster\update-service\target\thin\root\repository\org\springframework\boot\spring-boot-dependencies\1.5.1.RELEASE\spring-boot-dependencies-1.5.1.RELEASE.pom, line 621, column 16
[ERROR] Non-resolvable import POM: Could not transfer artifact org.springframework:spring-framework-bom:pom:4.3.6.RELEASE from/to nexus-foo (https://internal-server/nexus/repository/public/): status code: 401, reason phrase: Unauthorized (401) @ org.springframework.boot:spring-boot-dependencies:1.5.1.RELEASE, D:\Dev\git\coc\spice-configuration-cluster\update-service\target\thin\root\repository\org\springframework\boot\spring-boot-dependencies\1.5.1.RELEASE\spring-boot-dependencies-1.5.1.RELEASE.pom, line 2014, column 16
[ERROR] Non-resolvable import POM: Could not transfer artifact org.springframework.data:spring-data-releasetrain:pom:Ingalls-RELEASE from/to nexus-foo (https://internal-server/nexus/repository/public/): status code: 401, reason phrase: Unauthorized (401) @ org.springframework.boot:spring-boot-dependencies:1.5.1.RELEASE, D:\Dev\git\coc\spice-configuration-cluster\update-service\target\thin\root\repository\org\springframework\boot\spring-boot-dependencies\1.5.1.RELEASE\spring-boot-dependencies-1.5.1.RELEASE.pom, line 2087, column 16
[ERROR] Non-resolvable import POM: Could not transfer artifact org.springframework.integration:spring-integration-bom:pom:4.3.7.RELEASE from/to nexus-foo (https://internal-server/nexus/repository/public/): status code: 401, reason phrase: Unauthorized (401) @ org.springframework.boot:spring-boot-dependencies:1.5.1.RELEASE, D:\Dev\git\coc\spice-configuration-cluster\update-service\target\thin\root\repository\org\springframework\boot\spring-boot-dependencies\1.5.1.RELEASE\spring-boot-dependencies-1.5.1.RELEASE.pom, line 2109, column 16
[ERROR] Non-resolvable import POM: Could not transfer artifact org.springframework.security:spring-security-bom:pom:4.2.1.RELEASE from/to nexus-foo (https://internal-server/nexus/repository/public/): status code: 401, reason phrase: Unauthorized (401) @ org.springframework.boot:spring-boot-dependencies:1.5.1.RELEASE, D:\Dev\git\coc\spice-configuration-cluster\update-service\target\thin\root\repository\org\springframework\boot\spring-boot-dependencies\1.5.1.RELEASE\spring-boot-dependencies-1.5.1.RELEASE.pom, line 2201, column 16

        at hidden.org.apache.maven.model.building.DefaultModelProblemCollector.newModelBuildingException(DefaultModelProblemCollector.java:197)
        at hidden.org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:482)
        at hidden.org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:424)
        at hidden.org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:414)
        at hidden.org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:158)
        ... 7 more

@dsyer
Copy link
Collaborator

dsyer commented Sep 21, 2023

I noticed that your URLs look inconsistent: you want to use http://nexus in the first example and that doesn't seem to be a correct URL (http protocol for one thing), so I'm guessing it is just getting a 404. The 401 suggests there is an issue with credentials. AFAIK it's supposed to work, but it's a hard thing to test, however the URL also looks odd because you define those properties like release-server-url and then don't use them.

I would actually expect just a mirror would work, but I don't know how a mirror with "mirrorOf=*" is supposed to behave so that might be a problem.

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

No branches or pull requests

2 participants