Maven Licensing

I am a little confused with the various ways of posting license information in a maven project.

If I put the license in a tag inside the POM file, does this mean that my entire project has this license?

If I put the license.txt file in the project, does this mean that the project belongs to this license?

And what if I put a license at the beginning of every .java file that I have. Does this mean that every class I wrote can have different licenses?

How about a situation where I have license information in the header of the POM file. Does this mean that all files are under this license?

So confused ...

+7
source share
2 answers

Don’t worry, you are not the only one who is embarrassed. This problem is not limited to Java. Maven at least provides a mechanism for breaking down a project into individual modules, each with a metadata (POM) file describing the license of the modules.

The problem is that the software user who wants to be compatible with the license can be sure that all the files (in the software package) belong to the same software license. There are slight differences and consequences of using some open source licenses.

HP has launched its license scanning system.

http://www.fossology.org/

This allows the organization to scan the source code of third-party libraries and discover the license. This analysis follows standard methods that have arisen over time (README License, Comment Title in the License, etc. Etc.). For organizations that prefer to outsource this work, there are commercial companies that support open source databases:

There is light at the end of the tunnel. The linux foundation has begun work to solve this problem:

http://spdx.org/

This is a great idea. Create a single standard that allows software developers to explicitly specify the license of each file. One real success of the group is the collection of a common list of license names. The only drawback, as I see it, is the lack of developer support and tool support.

In conclusion, I would recommend storing all files in the maven module of the same license. Assuming your module is open source, enter this license in the comment heading and publish this license to Maven POM. If your code is closed source, it seems to me that including a license in the META-INF directory helps, but does not completely eliminate compliance issues.

+5
source

A project may have different licenses according to need. You might want to have an Apache license and a MIT, BSD license. The idea of ​​allowing your code to have multiple licenses is to let companies choose the license that they are happy with.

These licenses are usually stored in META-INF / LICENSE files. * (e.g. LICENSE.BSD, LICENSE.Apache, etc.).

If you define a license in the POM, this means that the Maven site plugin will use this line when creating the Maven site.

It’s best to have an appropriate licensing header over each of your classes to avoid potential confusion for project adopters.

If you perform the so-called “shading” (including classes of other libraries in your bank), then you will most likely get your license in your META-INF directory. Be careful, as it may overwrite your project license if the name of the corresponding license file is just LICENSE.

Usually you place the license files in the src/main/resources/META-INF .

+2
source

All Articles