Re: [java] [gradle] Generated Sources and inexplicably Ignored Folders

2019-07-29 Thread Laszlo Kishalmi
Can I have a JIRA ticket on this also could you attach a sample project, 
I can play with?


On 7/29/19 3:10 AM, Chris Mackey wrote:

I have a gradle project that is generating classes at build time based
off some protobuff definitions. These are being generated in the
folder:

build/generated/source/proto/main/java

The Gradle IDEA plugin is applied to the project, so to my
understanding, it should automatically add the generated folder as a
sourceSet. This used to be the case for the Gradle plugin in the
previous version of NetBeans I used (8.1). This is my first issue, as
it's not clear that the built-in Gradle in NetBeans 11.1 is observing
this, as I do not see the additional sourceSet.

Secondly, even if I add the sourceSet myself in Gradle, and do not
rely on the IDEA plugin to do it for me, it shows up in NetBeans, but
it appears to be ignored. So I can see it, but I can't look at its
contents in the package view. I tried without "build/" being part of
the gitignore file, and "build" is not part of the regex that allows
me to define my own ignored folders. So I'm at a bit of a loss as to
how this folder is still being ignored, and if it is at all
configurable.

I tried moving the generated sources out of build and into:

generated-sources/source/proto/main/java

This and manually adding the updated sourceSet worked, but it's a
change that may affect many others (for whom my explanation will be
met with "Just use IntelliJ"), so I'd rather avoid it if possible.

Any ideas or explanations welcome!

-
To unsubscribe, e-mail: users-unsubscr...@netbeans.apache.org
For additional commands, e-mail: users-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists



-
To unsubscribe, e-mail: users-unsubscr...@netbeans.apache.org
For additional commands, e-mail: users-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists



Missing JavaDoc and failing "Go to Declaration" in Maven projects

2019-07-29 Thread Tobias Oelgarte
Im running Netbeans 11.1 on Linux with Maven projects. I have downloaded 
the sources and javadoc for my dependencies (for example 
jetty-server-10.0.0-alpha0) and ensured that they are stored with the 
right name. But I'm unable to view the JavaDocs of most constructors and 
methods from my dependencies, with the error message "Javadoc not 
found". Additionally I can't go to the declarations. Netbeans opens the 
source file, but can't go to the declaration for some reason ("The 
destination was not found, source opened at default position"), even so 
the Navigator is able to show all methods.


This always happens if one maven dependency makes use of another 
dependency/library. For example:
- org.eclipse.jetty.server.Server(int port) is fine. (Javadoc will be 
displayed and Go to is working)
- org.eclipse.jetty.server.Server(ThreadPool pool) fails. (ThreadPool is 
a class from another library/module)


Some way to fix this, or is this a known issue?

--
Tobias Oelgarte
Mail: tobias.oelga...@gmail.com



smime.p7s
Description: S/MIME Cryptographic Signature


Re: Injection of an EntityManager is not adapted to CMT mode

2019-07-29 Thread Richard Grin
Hi Ortiz,

The EJB in which I inject is NOT annotated by

@TransactionManagement( TransactionManagementType.BEAN)

so, by default, the transactions are managed by the container: one automatic 
commit or rollback at the end of the method which started the transaction (I 
won't go into the details... ; see 
https://javaee.github.io/tutorial/transactions004.html#BNCIJ). A 
UserTransaction must not be used. The old versions of NetBeans inserted the 
good code.

See the code of Arjan Tijms in 
https://stackoverflow.com/questions/8772175/how-to-implement-container-managed-transaction-cmt.

Regards,

Richard

Le 29/07/2019 à 13:33, Javier Ortiz a écrit :
The current one seems completely correct to me. What error/problem are you 
getting?

That's an atomic operation.

On Mon, Jul 29, 2019, 5:31 AM Richard Grin 
mailto:richard.g...@univ-cotedazur.fr>> wrote:
Hi,

NetBeans 11.1.

The code generated by NetBeans for the injection of an EntityManager is
not adapted to the CMT (Container Managed Transaction) mode. "Generate"
menu for "Insert code..." > "Use Entity Manager...".

The generated code:

 @PersistenceContext(unitName = "xxx")
 private EntityManager em;
 @Resource
 private javax.transaction.UserTransaction utx;

 public void persist(Object object) {
 try {
 utx.begin();
 em.persist(object);
 utx.commit();
 } catch (Exception e) {
Logger.getLogger(getClass().getName()).log(Level.SEVERE, "exception
caught", e);
 throw new RuntimeException(e);
 }
 }

It should be

 @PersistenceContext(unitName = xxx")
 private EntityManager em;

 public void persist(Object object) {
 em.persist(object);
 }

Richard


--
Cordialement,

Richard Grin


Netbeans 11.1 + Gradle + Spock Unit Tests

2019-07-29 Thread Fred Welland
Just started using NB 11.1  (OpenJDK 1.8 202).

I am using the built in gradle project support on a project with some Spock
unit specs.

NB 11.1 loads the specs ok into editor window.Right clicking in the
editor window brings up the context menu. There are some test related
actions that could happen, like "Test File", "Debug File" and so on.

"Test File" and "Debug File" are disabled.   "Run Focused Test Method" (and
the debug variant) are active, but do not seem to do anything.

Are any of these supported?

FWIW:   I can open same project in NB 10.0 (same JDK).   The NB install
uses the gradle plugin (not built-in stuff).   These context menu items
work fine under NB10.0 + gradle plugin.


NB 11.1 compile error with OpenJDK 11

2019-07-29 Thread Roberto Bottoni

NB 11.1 (fresh installation) on Windows 10
OpenJDK 11.0.2

I have a project created with JDK 8 and NB 8.2 and I want to migrate 
this project to NB 11.1 with OpenJDK 11


I copied all the sources and libraries (.jars) into a new project NB 11 
/ OpenJDK 11 and solved the (few) problems from JDK 8 to OpenJDK 11 ..


but, when i build the project, I get this error :

error : option -Xbootclasspath/P: not allowed with target 11

I think this is a problem related to the java version .. so in the 
project properties panel, I changed the Source / Binary format from JDK 
11 to JDK 8 .. and everything went well!


but .. how can I solve it (with the Sorces jdk 11 format) .. I remember 
that in NB 8.2 I did the same with a project from jdk 7 to jdk 8 ..


thanks!
Roberto


-
To unsubscribe, e-mail: users-unsubscr...@netbeans.apache.org
For additional commands, e-mail: users-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists



Injection of an EntityManager is not adapted to CMT mode

2019-07-29 Thread Richard Grin
Hi,

NetBeans 11.1.

The code generated by NetBeans for the injection of an EntityManager is 
not adapted to the CMT (Container Managed Transaction) mode. "Generate" 
menu for "Insert code..." > "Use Entity Manager...".

The generated code:

     @PersistenceContext(unitName = "xxx")
     private EntityManager em;
     @Resource
     private javax.transaction.UserTransaction utx;

     public void persist(Object object) {
     try {
     utx.begin();
     em.persist(object);
     utx.commit();
     } catch (Exception e) {
Logger.getLogger(getClass().getName()).log(Level.SEVERE, "exception 
caught", e);
     throw new RuntimeException(e);
     }
     }

It should be

     @PersistenceContext(unitName = xxx")
     private EntityManager em;

     public void persist(Object object) {
     em.persist(object);
     }

Richard



[java] [gradle] Generated Sources and inexplicably Ignored Folders

2019-07-29 Thread Chris Mackey
I have a gradle project that is generating classes at build time based
off some protobuff definitions. These are being generated in the
folder:

build/generated/source/proto/main/java

The Gradle IDEA plugin is applied to the project, so to my
understanding, it should automatically add the generated folder as a
sourceSet. This used to be the case for the Gradle plugin in the
previous version of NetBeans I used (8.1). This is my first issue, as
it's not clear that the built-in Gradle in NetBeans 11.1 is observing
this, as I do not see the additional sourceSet.

Secondly, even if I add the sourceSet myself in Gradle, and do not
rely on the IDEA plugin to do it for me, it shows up in NetBeans, but
it appears to be ignored. So I can see it, but I can't look at its
contents in the package view. I tried without "build/" being part of
the gitignore file, and "build" is not part of the regex that allows
me to define my own ignored folders. So I'm at a bit of a loss as to
how this folder is still being ignored, and if it is at all
configurable.

I tried moving the generated sources out of build and into:

generated-sources/source/proto/main/java

This and manually adding the updated sourceSet worked, but it's a
change that may affect many others (for whom my explanation will be
met with "Just use IntelliJ"), so I'd rather avoid it if possible.

Any ideas or explanations welcome!

-
To unsubscribe, e-mail: users-unsubscr...@netbeans.apache.org
For additional commands, e-mail: users-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists



Javadoc popup works, but "Show Javadoc" does not.

2019-07-29 Thread Thomas Kellerer
Using NetBeans 11.1 on Windows.

I have a strange behaviour with displaying Javadoc help for methods from the 
JDK.

The code completion (Ctrl-Space) displays the little Javadoc popup and so does 
the JavaDoc window (Window -> IDE Tools -> JavaDoc Documentation) when I open 
it.

But Alt-F1 ("Show Javadoc") for that exact same method (where the Javadoc popup 
is displayed) only gives an "Cannot perform Show Javadoc here" message in the 
status line.

Shift-F1 ("Search Javadoc") also finds the relevant entry, and doubleclicking 
on it opens the default browser with the JDK documentation.

This is with a Maven project using OpenJDK 11 with self generated JavaDocs.

It seems that "Alt-F1" (or choosing "Show Javadoc" from the context menu in the 
editor) uses a different way to find the Javadoc than all the other methods.

Is it possible that my self-generated Javadoc is missing something that "Show 
Javadoc" needs, but the other methods don't?

This is how I generate the Javadoc index from the source of OpenJDK:

  javadoc -quiet -d docs -Xdoclint:none --expand-requires all 
--module-source-path src --module java.se

Do I need to specify a different "starting module"? Or is there a better way to 
generate the Javadoc for OpenJDK?

The usual panacea "start with a clean userdir" did not change this.

Thomas

-
To unsubscribe, e-mail: users-unsubscr...@netbeans.apache.org
For additional commands, e-mail: users-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists