This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Summary: | support for more licenses in maven | ||
---|---|---|---|
Product: | projects | Reporter: | Golthiryus |
Component: | Maven | Assignee: | Milos Kleint <mkleint> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | jglick |
Priority: | P3 | ||
Version: | 7.1.1 | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | ENHANCEMENT | Exception Reporter: | |
Bug Depends on: | |||
Bug Blocks: | 204221 | ||
Attachments: |
Example of EPL license notice template
Corresponding attributes LGPL header template LGPL 3.0 header template LGPL 2.1 header template Suggested license-bsd.txt |
Description
Golthiryus
2012-04-24 14:08:06 UTC
what license + url combinations are you suggesting? I was thinking in LGPL license. Maven is great to make libraries ;) Actually as a user it is possible to add support for other licenses, though not via the GUI: create the license in Template Manager normally, then edit $userdir/config/Templates/Licenses/.nbattrs and add <attr name="mavenLicenseURL" stringvalue="http://..."/> But of course it would be nice if the most commonly-used licenses were predefined in the IDE - at least LGPL 2.1 and 3.0, and maybe EPL, GPL w/ "Classpath Exception" (cf. OpenJDK), CDDL. And for user expansion it would be nice if Template Manager let you set the URL. Unfortunately while Maven has a rather strong system of defining artifacts themselves, the structure of license definitions is quite weak; there is no way for repositories to standardize on particular license names or URLs. http://opensource.org/licenses/alphabetical has the most authoritative list of (FLOSS) licenses, though not formatted well for machine use (no "raw mode" URLs that I know of). Created attachment 118704 [details]
Example of EPL license notice template
Created attachment 118705 [details]
Corresponding attributes
(In reply to comment #3) > it would be nice if Template Manager let you set the URL As of core-main #e158741ebfd5 you can select the Properties menu item on the newly created template (*) and edit the new "License URL" property. Still I think it would be good for more common licenses to be included out of the box. (*) Which must be named "license-SOMETHING", where "SOMETHING" would also be the value of ${project.license} for an Ant-based project. Otherwise you get an exception, reduced to warning in core-main #7196660695be. (In reply to comment #6) > (In reply to comment #3) > > it would be nice if Template Manager let you set the URL > > Still I think it would be good for more common licenses to be included out of > the box. > The main challenge was always to know what the header template should look like and what url should be associated with it. Standard Netbeans way to add licenses (Templates) are really bad to work in a team. Netbeans Maven Support way is better in this case, but is not "editable", ie, it is limited to a small set of licenses. On the other hand, maven-license-plugin works really well. unfortunately we cannot simply reuse external license templates. it needs to be in freemarker format and in a way that supports adding the license header to other files than java files, eg. .properties or .xml files as wel.. @Milos I do not understand you. Translate the header of a license should be (in theory) fast and easy. If I may ask... How it was done with the other four? I understand that is not a priority. If I can help with something (for example by adapting the headers) let me know. (In reply to comment #10) > @Milos I do not understand you. Translate the header of a license should be (in > theory) fast and easy. If I may ask... How it was done with the other four? you need the canonical header (which is not equal to the license text and in some cases is hard to come by) and you need to add the processing expressions like: <#if licenseFirst??> ${licenseFirst} </#if> ${licensePrefix} and then pick the canonical url that will most likely be used most users.. We also have a property "netbeans.hint.license" that can contain the license name (ideally in the parent pom). So the url is not really critical, having the right license template is. And as you mentioned it's still suboptimal as one needs to add the license template to each and every developer's IDE installation. > > I understand that is not a priority. If I can help with something (for example > by adapting the headers) let me know. sure, that would help a lot. So I understand that when pom url license is GPL2, GPL3, MIT or Apache (which are supported by default by Netbeans), Maven Support uses Netbeans builtin template, so to support new licenses in Netbeans Maven Support is necessary that this licenses were supported by Netbeans before. All right. When I have some time I will look for some license headers to adapt them to Netbeans Templates. Golthiryus, just look at the two attachments I produced for EPL - this should give you the idea of the required format, especially available FreeMarker variables. The license header templates could probably use some further tweaking, BTW. For example, I noticed that in the Sonatype Aether case, the organization name "Sonatype, Inc." is substituted nicely in the "Contributors" section but looks ugly in the "Copyright" section: /* Copyright (c) 2012 Sonatype, Inc.. ^^ Presumably the template could be a little smarter and check for a trailing '.' in this case. (In reply to comment #12) > when pom url license is GPL2, GPL3, MIT or Apache (which > are supported by default by Netbeans), Maven Support uses Netbeans builtin > template Generally, when creating a new file in a Maven project, the IDE first checks for ${netbeans.hint.license} among POM properties, including inherited ones. (For Ant-based projects, it would look for ${project.license} among Ant property definitions.) If Templates/Licenses/license-NAME.txt exists (whether a built-in license header, or a user-defined one), then that is processed with FreeMarker and inserted into the new file (*). Else, if the POM (or again a parent POM acc. to usual model inheritance) specifies /project/license/url and there is a Templates/Licenses/license-*.txt with a matching mavenLicenseURL property (as editable in Template Manager after my recent fix, and defined for the built-in license headers), then that header is used. Otherwise, the default placeholder header is used. (*) Assuming the file template requests a license header, e.g.: <#assign licenseFirst = "/*"> <#assign licensePrefix = " * "> <#assign licenseLast = " */"> <#include "../Licenses/license-${project.license}.txt"> BTW maven/src/org/netbeans/modules/maven/layer.xml is the location in NetBeans sources where most of the built-in licenses are defined. (There is the placeholder fallback license elsewhere, and apisupport.project defines CDDL+GPL2/CP used for NetBeans sources.) Thanks for the info. I can not do anything until next Thursday, but I keep in mind. Integrated into 'main-golden', will be available in build *201204260400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/7196660695be User: Jesse Glick <jglick@netbeans.org> Log: SIOOBE encountered while experimenting with #211644. Created attachment 120358 [details]
LGPL header template
This could be an LGPL3 example.
(In reply to comment #17) > Created attachment 120358 [details] > LGPL header template > > This could be an LGPL3 example. And url that identifies this license should be http://www.gnu.org/licenses/lgpl-3.0.html (In reply to comment #18) > (In reply to comment #17) > > Created attachment 120358 [details] > > LGPL header template > > > > This could be an LGPL3 example. > > And url that identifies this license should be > http://www.gnu.org/licenses/lgpl-3.0.html add the the LGPL and EPL license templates to the IDE. However the LGPL is apparently version 2.1, not 3.0. (The header text is exactly the same as the one stated on http://www.gnu.org/licenses/lgpl-2.1.html Created attachment 120364 [details]
LGPL 3.0 header template
I didn't find an oficial version of that header in GNU webpage, so I mixed LGPL2.1 header license with GPL 3.0 header license
Created attachment 120365 [details]
LGPL 2.1 header template
Integrated into 'main-golden', will be available in build *201206060001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/ddf3127713e7 User: Milos Kleint <mkleint@netbeans.org> Log: #211644 lgpl3.0 license header template - contributed by Golthiryus@netbeans.org Created attachment 124657 [details] Suggested license-bsd.txt displayName: BSD 2-Clause License mavenLicenseURL: http://opensource.org/licenses/bsd-license.php bsd - http://hg.netbeans.org/core-main/rev/be5352f5944d let's just consider this fixed, please file a separate issue for each template missing. Thanks. BTW "General Public Licence 3.0" is spelled UK fashion whereas http://www.gnu.org/licenses/gpl-3.0.html as an American site uses "Licen_s_e". Integrated into 'main-golden', will be available in build *201209220001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/be5352f5944d User: Milos Kleint <mkleint@netbeans.org> Log: #211644 bsd license added |