You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2022/02/28 02:55:52 UTC
[GitHub] [netbeans] dgreen opened a new issue #3678: Creating new application (Java With Maven, Java Application) has main class built ignoring templates
dgreen opened a new issue #3678:
URL: https://github.com/apache/netbeans/issues/3678
### Apache NetBeans version
Apache NetBeans 13 release candidate
### What happened
Creating a new Java with Maven, Java Application generates a Java file with a main. The file is generated ignoring the available template for Java Main Class.
Somewhat unrelated to this issue, clicking on the nbfs: links did not cause any noticeable activity.
### How to reproduce
1. File | New Project
2. In popup, choose Java with Maven then Java Application
3. Hit finish on next pop up
4. Generated project has a MavenProject1.java file with a main
It has
`
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Project/Maven2/JavaApp/src/main/java/${packagePath}/${mainClassName}.java to edit this template
*/
package edu.uab.mavenproject1;
/**
*
* @author name <email>
*/
public class Mavenproject1 {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}
`
There is an existing template viewable using Tools | Templates , select Java, then Java Main Class, open in editor
`
/*
* Author: ${user}
* Assignment: ${project.displayName} - ${course}
*
* Credits: (if any for sections of code)
*/
<#if package?? && package != "">
package ${package};
</#if>
<#if superclass?? && superclass != "" && !superclass?starts_with("java.lang") && !superclass?matches(package + "\\.\\w+")>
import ${superclass};
</#if>
<#if interfaces?? && interfaces != "">
<#list "${interfaces}"?split("\n") as interface>
<#if interface?? && interface != "" && !interface?starts_with("java.lang") && !interface?matches(package + "\\.\\w+")>
import ${interface};
</#if>
</#list>
</#if>
/**
*
*/
<#if superclass?? && superclass != "">
<#assign extension = "${superclass}"[("${superclass}"?last_index_of(".") + 1)..]>
</#if>
<#if interfaces?? && interfaces != "">
<#assign implementation = "">
<#list "${interfaces}"?split("\n") as interface>
<#assign implementation += "${interface}"[("${interface}"?last_index_of(".") + 1)..] + ", ">
</#list>
<#assign implementation = "${implementation}"?remove_ending(", ")>
</#if>
public class ${name}<#if extension?? && extension != ""> extends ${extension}</#if><#if implementation?? && implementation != ""> implements ${implementation}</#if> {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
}
}
`
### Did this work correctly in an earlier version?
Apache NetBeans 12.6
### Operating System
MacOS 12.2.1 (Monterey) M1 Pro
### JDK
JDK 17
### Apache NetBeans packaging
Apache NetBeans provided installer
### Anything else
Note: the previous 12.6 did not add a starting file as part of project completion.
### Are you willing to submit a pull request?
_No response_
### Code of Conduct
Yes
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] mbien commented on issue #3678: Creating new application (Java With Maven, Java Application) has main class built ignoring templates
Posted by GitBox <gi...@apache.org>.
mbien commented on issue #3678:
URL: https://github.com/apache/netbeans/issues/3678#issuecomment-1054134122
@sdedic where is the second link actually supposed to point at?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] mbien commented on issue #3678: Creating new application (Java With Maven, Java Application) has main class built ignoring templates
Posted by GitBox <gi...@apache.org>.
mbien commented on issue #3678:
URL: https://github.com/apache/netbeans/issues/3678#issuecomment-1080221805
I made some minor improvements to templates with PR #3876.
I did also take a look at this issue here, but tbh I am not even sure how it is supposed to work.
For example a new maven specific template was added with [App.java.template in this PR](https://github.com/apache/netbeans/pull/3262/files#diff-2ebd3952d2ae6a5950392cb0f0b9b8b2cc71c662a0d855186102e0b2f1009c06) but I can't find it under Tools -> Templates.
Should it appear there? Or why does each project type ship with its own template instead of using the common "Java Main Class" template (which the user above IMO correctly assumed would influence new project creation).
Gradle project has its own template too, only ANT uses "Java Main Class" template.
@sdedic @JaroslavTulach @lkishalmi @matthiasblaesing Sorry for pinging everyone but this is a cross project type issue :)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] dgreen commented on issue #3678: Creating new application (Java With Maven, Java Application) has main class built ignoring templates
Posted by GitBox <gi...@apache.org>.
dgreen commented on issue #3678:
URL: https://github.com/apache/netbeans/issues/3678#issuecomment-1054417695
Confirming that CMD-click (Mac) does work on the first link.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] mbien edited a comment on issue #3678: Creating new application (Java With Maven, Java Application) has main class built ignoring templates
Posted by GitBox <gi...@apache.org>.
mbien edited a comment on issue #3678:
URL: https://github.com/apache/netbeans/issues/3678#issuecomment-1054063634
the second link seems to be broken, but ctrl+click on the first (license template) does work for me.
I could change the template and the next new project did use it, so the mechanism appears to be working.
* second link needs to be repaired
* it should also say "ctrl+click" instead of just "Click" to avoid any confusion
* the template for a new main class does work too, its just that new maven projects have now their own template for some reason instead of using the existing new main class template
Thanks for the report.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] mbien edited a comment on issue #3678: Creating new application (Java With Maven, Java Application) has main class built ignoring templates
Posted by GitBox <gi...@apache.org>.
mbien edited a comment on issue #3678:
URL: https://github.com/apache/netbeans/issues/3678#issuecomment-1054063634
the second link seems to be broken, but ctrl+click on the first (license template) does work for me.
I could change the template and the next new project did use it, so the mechanism appears to be working.
* second link needs to be repaired
* it should also say "ctrl+click" instead of just "Click" to avoid any confusion
* the template for a new main class does work too, its just that new maven projects have now their own template for some reason instead of using the existing new main class template (edit: changed in #3262)
Thanks for the report.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] neilcsmith-net commented on issue #3678: Creating new application (Java With Maven, Java Application) has main class built ignoring templates
Posted by GitBox <gi...@apache.org>.
neilcsmith-net commented on issue #3678:
URL: https://github.com/apache/netbeans/issues/3678#issuecomment-1054143321
This was obviously also brought up recently in https://lists.apache.org/thread/dhlwp3wkglfk9265g362olj2b0dphqoq
I'm curious too why the second link has tokens in it? Is this a mistake in the template in use, or a sign that templating isn't correctly set up at the point it's triggering?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] mbien edited a comment on issue #3678: Creating new application (Java With Maven, Java Application) has main class built ignoring templates
Posted by GitBox <gi...@apache.org>.
mbien edited a comment on issue #3678:
URL: https://github.com/apache/netbeans/issues/3678#issuecomment-1054063634
the second link seems to be broken, but ctrl+click on the first (license template) does work for me.
I could change the template and the next new project did use it, so the mechanism appears to be working.
* second link needs to be repaired
* it should also say "ctrl+click" instead of just "Click" to avoid any confusion
* the template for a new main class does work too, its just that new maven projects have now their own template for some reason instead of using the existing new main class template
Adding good-first-issue label (for parts of this issue at least). Thanks for the report.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] mbien commented on issue #3678: Creating new application (Java With Maven, Java Application) has main class built ignoring templates
Posted by GitBox <gi...@apache.org>.
mbien commented on issue #3678:
URL: https://github.com/apache/netbeans/issues/3678#issuecomment-1054063634
the second link seems to be broken, but ctrl+click on the first (license template) does work for me.
I could change the template and the next new project did use it, so the mechanism appears to be working. (second link needs to be fixed though).
It should also say "ctrl+click" instead of just "Click" to avoid any misunderstandings.
Adding good-first-issue label. Thanks for the report.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists