You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Markus KARG (JIRA)" <ji...@codehaus.org> on 2011/01/16 17:33:57 UTC

[jira] Created: (MNG-4981) Using compiler API instead of tools.jar

Using compiler API instead of tools.jar
---------------------------------------

                 Key: MNG-4981
                 URL: http://jira.codehaus.org/browse/MNG-4981
             Project: Maven 2 & 3
          Issue Type: New Feature
          Components: Bootstrap & Build
    Affects Versions: 3.1
            Reporter: Markus KARG
            Priority: Minor


Currently (MVN 3.0) java compilation needs tools.jar provided by the Sun JDK:

[ERROR] Unable to locate the Javac Compiler in:
[ERROR] C:\Program Files\Java\jre6\..\lib\tools.jar
[ERROR] Please ensure you are using JDK 1.4 or above and
[ERROR] not a JRE (the com.sun.tools.javac.Main class is required).
[ERROR] In most cases you can change the location of your Java
[ERROR] installation by setting the JAVA_HOME environment variable.

In fact, this is bad because (a) it assumes that a full JDK is installed just for this sole tool where a JRE would be sufficient, (b) tools.jar is not contained in any standards documents and such possibly is not existing on future or non-sun JDK.

Since JRE 6 (i. e. for many years) the JRE (not JDK!) comes with a standardized (!) API for compilation: The Java Compiler API. It would make sense to use that standardized API instead of forcing the user to have Sun JDK installed.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] (MCOMPILER-144) Using compiler API instead of tools.jar

Posted by "David M. Lloyd (JIRA)" <ji...@codehaus.org>.
    [ https://jira.codehaus.org/browse/MCOMPILER-144?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=309809#comment-309809 ] 

David M. Lloyd commented on MCOMPILER-144:
------------------------------------------

https://github.com/sonatype/plexus-compiler/pull/6 (PLXCOMP-1) is relevant here.
                
> Using compiler API instead of tools.jar
> ---------------------------------------
>
>                 Key: MCOMPILER-144
>                 URL: https://jira.codehaus.org/browse/MCOMPILER-144
>             Project: Maven 2.x Compiler Plugin
>          Issue Type: New Feature
>            Reporter: Markus KARG
>            Priority: Minor
>
> Currently (MVN 3.0) java compilation needs tools.jar provided by the Sun JDK:
> [ERROR] Unable to locate the Javac Compiler in:
> [ERROR] C:\Program Files\Java\jre6\..\lib\tools.jar
> [ERROR] Please ensure you are using JDK 1.4 or above and
> [ERROR] not a JRE (the com.sun.tools.javac.Main class is required).
> [ERROR] In most cases you can change the location of your Java
> [ERROR] installation by setting the JAVA_HOME environment variable.
> In fact, this is bad because (a) it assumes that a full JDK is installed just for this sole tool where a JRE would be sufficient, (b) tools.jar is not contained in any standards documents and such possibly is not existing on future or non-sun JDK.
> Since JRE 6 (i. e. for many years) the JRE (not JDK!) comes with a standardized (!) API for compilation: The Java Compiler API. It would make sense to use that standardized API instead of forcing the user to have Sun JDK installed.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Moved: (MCOMPILER-144) Using compiler API instead of tools.jar

Posted by "Brett Porter (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MCOMPILER-144?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Brett Porter moved MNG-4981 to MCOMPILER-144:
---------------------------------------------

           Complexity:   (was: Intermediate)
          Component/s:     (was: Bootstrap & Build)
    Affects Version/s:     (was: 3.1)
                  Key: MCOMPILER-144  (was: MNG-4981)
              Project: Maven 2.x Compiler Plugin  (was: Maven 2 & 3)

> Using compiler API instead of tools.jar
> ---------------------------------------
>
>                 Key: MCOMPILER-144
>                 URL: http://jira.codehaus.org/browse/MCOMPILER-144
>             Project: Maven 2.x Compiler Plugin
>          Issue Type: New Feature
>            Reporter: Markus KARG
>            Priority: Minor
>
> Currently (MVN 3.0) java compilation needs tools.jar provided by the Sun JDK:
> [ERROR] Unable to locate the Javac Compiler in:
> [ERROR] C:\Program Files\Java\jre6\..\lib\tools.jar
> [ERROR] Please ensure you are using JDK 1.4 or above and
> [ERROR] not a JRE (the com.sun.tools.javac.Main class is required).
> [ERROR] In most cases you can change the location of your Java
> [ERROR] installation by setting the JAVA_HOME environment variable.
> In fact, this is bad because (a) it assumes that a full JDK is installed just for this sole tool where a JRE would be sufficient, (b) tools.jar is not contained in any standards documents and such possibly is not existing on future or non-sun JDK.
> Since JRE 6 (i. e. for many years) the JRE (not JDK!) comes with a standardized (!) API for compilation: The Java Compiler API. It would make sense to use that standardized API instead of forcing the user to have Sun JDK installed.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MCOMPILER-144) Using compiler API instead of tools.jar

Posted by "Jesse Glick (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MCOMPILER-144?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=262535#action_262535 ] 

Jesse Glick commented on MCOMPILER-144:
---------------------------------------

The JRE does indeed include an API for invoking the Java compiler - but the implementation is still in {{tools.jar}}, so calling it from a bare JRE will just produce an error. Also the API is not available in Java 5 which Maven still supports (for running itself).

On the other hand, it would be possible to publish the version of javac in OpenJDK 6 and/or 7 in Central and then use this as a runtime-scope dependency for the compiler plugin. This would also allow your project to determine exactly which compiler it is using, rather than being at the mercy of the user's JDK; see my Aug 2010 comments in MNG-1867. The version from OpenJDK 6 is probably unusable since AFAIK bug fixes from JDK 6 updates do not get backported to it; the version from OpenJDK 7 is much better and contains many critical fixes especially for people using annotation processors (see e.g. MCOMPILER-122).

> Using compiler API instead of tools.jar
> ---------------------------------------
>
>                 Key: MCOMPILER-144
>                 URL: http://jira.codehaus.org/browse/MCOMPILER-144
>             Project: Maven 2.x Compiler Plugin
>          Issue Type: New Feature
>            Reporter: Markus KARG
>            Priority: Minor
>
> Currently (MVN 3.0) java compilation needs tools.jar provided by the Sun JDK:
> [ERROR] Unable to locate the Javac Compiler in:
> [ERROR] C:\Program Files\Java\jre6\..\lib\tools.jar
> [ERROR] Please ensure you are using JDK 1.4 or above and
> [ERROR] not a JRE (the com.sun.tools.javac.Main class is required).
> [ERROR] In most cases you can change the location of your Java
> [ERROR] installation by setting the JAVA_HOME environment variable.
> In fact, this is bad because (a) it assumes that a full JDK is installed just for this sole tool where a JRE would be sufficient, (b) tools.jar is not contained in any standards documents and such possibly is not existing on future or non-sun JDK.
> Since JRE 6 (i. e. for many years) the JRE (not JDK!) comes with a standardized (!) API for compilation: The Java Compiler API. It would make sense to use that standardized API instead of forcing the user to have Sun JDK installed.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira