question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

License in Spring Boot parent is applied to generated projects with Maven

See original GitHub issue

I used https://start.spring.io/ to create 2.5.0 template Maven project: image

To my surprise the created project declares a bit strange licensing information. The license is Apache for example:

demo$ mvn help:effective-pom | grep licenses -C 2
  <description>Demo project for Spring Boot</description>
  <url>https://spring.io/projects/spring-boot/demo</url>
  <licenses>
    <license>
      <name>The Apache Software License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
    </license>
  </licenses>
  <developers>
    <developer>

You may be inclined to discard this report saying that the generated pom.xml doesn’t have such licensing information and that’s just the effecitve pom inheriting the license from the parent pom. True, but for various tools it’s the effective pom that matters!

I’ve discovered this issue because my IDE started to insert Apache license headers into newly created files in the project. Why? Because it asked mvn help:effective-pom for project object model. The model claims the project has Apache license.

Should I take the generated project and use mvn deploy - it would be uploaded into Maven central or any other Nexus, Artifactory repository under the Apache license.

Should some hacker break in and steal my code and then claim hey well the code is apache licensed so whatever, how am I supposed to defend? Shall I argue that spring initializr assigned Apache license to my code without letting me know?

I can easily fix my generated pom.xml by adding:

  <licenses>
      <license>
          <name>license of your choice</name>
      </license>      
  </licenses> 

as such direct declaration overrides anything inherited from parent projects. However I wanted to bring this issue to your attention as it seems to have interesting consequences.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
aalmiraycommented, Jun 7, 2021

FWIW defining empty elements as mentioned by @JaroslavTulach is what the Helidon team decided. You might want to check with them for pros & cons of that approach.

0reactions
JaroslavTulachcommented, Jun 7, 2021

The (rejected) suggestion of #1017 to include

<developers>
    <developer/>
</developers>
<licenses>
    <license/>
</licenses>
<scm>
    <url/>
</scm>
<url/>

in the generated project would be my solution as well.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting Started | Creating a Multi Module Project - Spring
This guide shows you how to create a multi-module project with Spring Boot. The project will have a library jar and a main...
Read more >
Spring Boot - parent pom when you already have a parent pom
Is there a specific recommended approach to the inclusion of the spring-boot parent pom into projects that already have a required parent POM?...
Read more >
Third-party - License Maven Plugin - MojoHaus
The license-maven-plugin provides some goals to help deal with dependencies that do not provide license metadata in their pom.xml files.
Read more >
The POM 4.0.0 XSD - Apache Maven
4.0.0+ The location of the parent project, if one exists. ... This is used to generate the license page of the project's web...
Read more >
Spring Boot Multi Module Project - Javatpoint
The parent maven project must contain the packaging type pom that makes the project as an aggregator. The pom.xml file of the parent...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found