You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by "Rohnny Moland (JIRA) (JIRA)" <ji...@codehaus.org> on 2005/10/26 22:54:19 UTC

[jira] Created: (MNG-1334) classpath related error when invoking the rmic task from maven

classpath related error when invoking the rmic task from maven
--------------------------------------------------------------

         Key: MNG-1334
         URL: http://jira.codehaus.org/browse/MNG-1334
     Project: Maven 2
        Type: Bug
  Components: maven-antrun-plugin  
    Versions: 2.0    
 Environment: OpenSuSE 10, JDK1.5, Maven 2.0
 Reporter: Rohnny Moland (JIRA)


When invoking the rmic task from maven, I get this error message:

"Cannot use SUN rmic, as it is not available.  A common solution is to
set the environment variable JAVA_HOME or CLASSPATH." 

Invoking the rmic task from ant works fine. So it must be a classpath problem when using ant embedded in maven.


-- 
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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


[jira] Commented: (MNG-1334) classpath related error when invoking the rmic task from maven

Posted by "Kenney Westerhof (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MNG-1334?page=comments#action_53268 ] 

Kenney Westerhof commented on MNG-1334:
---------------------------------------

Here is a complete POM that works. To test it I put the SUN 'RMI tutorial' code in src/main/java,
and added a 'setLogger(org.apache.log4j.Logger)' to 'Hello.java' and 'HelloImpl.java', to test
dependencies (it won't work in practise, but just illustrates the use of dependencies).

Generally: if your plugin needs dependencies to RUN (i.e. to execute 3rd party code), add those
dependencies to the PLUGIN dependencies - they have nothing to contribute to your projects code,
they're just used for building.



<project xmlns="http://maven.apache.org/maven-v4_0_0.xsd">

  <modelVersion>4.0.0</modelVersion>

  <groupId>testing</groupId>
  <artifactId>testantrun</artifactId>
  <packaging>jar</packaging>
  <version>0.1-SNAPSHOT</version>

  <name>TestAntRun</name>

  <!-- a test dependency to illustrate how to use that in ant tasks -->
  <dependencies>

    <dependency>
       <groupId>log4j</groupId>
       <artifactId>log4j</artifactId>
       <version>1.2.8</version>
    </dependency>

  </dependencies>

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <dependencies>

          <!-- runtime dependency for the antrun plugin. It brings tools.jar
             into the plugins execution space so the 'rmic' compiler can be called from
             Ant's <rmic/> task. This is ALL you have to do!
          -->
          <dependency>
            <groupId>sun</groupId>
            <artifactId>tools</artifactId>
            <version>1.0</version>
            <scope>system</scope>
            <systemPath>${java.home}/../lib/tools.jar</systemPath>
          </dependency>

        </dependencies>
        <executions>
          <execution>
            <phase>process-classes</phase>
            <configuration>
              <tasks>
                <!-- only add the COMPILE classpath here to import the dependencies
                needed to compile the sources (and hence the generated stubs).
                -->

                <rmic  verify="true" debug="on" classpathref="maven.compile.classpath"
                  includes="**/*.class"
                  base="target/classes"
                />
              </tasks>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

</project>



> classpath related error when invoking the rmic task from maven
> --------------------------------------------------------------
>
>          Key: MNG-1334
>          URL: http://jira.codehaus.org/browse/MNG-1334
>      Project: Maven 2
>         Type: Bug

>   Components: maven-antrun-plugin
>     Versions: 2.0
>  Environment: OpenSuSE 10, JDK1.5, Maven 2.0
>     Reporter: Rohnny Moland (JIRA)
>     Assignee: Brett Porter

>
>
> When invoking the rmic task from maven, I get this error message:
> "Cannot use SUN rmic, as it is not available.  A common solution is to
> set the environment variable JAVA_HOME or CLASSPATH." 
> Invoking the rmic task from ant works fine. So it must be a classpath problem when using ant embedded in maven.

-- 
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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


[jira] Commented: (MNG-1334) classpath related error when invoking the rmic task from maven

Posted by "Kenney Westerhof (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MNG-1334?page=comments#action_53264 ] 

Kenney Westerhof commented on MNG-1334:
---------------------------------------

The preferred way is this:

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <dependencies>

        <dependency>
          <groupId>sun</groupId>
          <artifactId>tools</artifactId>
          <version>1.0</version>
          <scope>system</scope>
          <systemPath>${java.home}/../lib/tools.jar</systemPath>
        </dependency>

        </dependencies>
        <executions>
          <execution>
            <phase>generate-test-sources</phase>
            <configuration>
              <tasks>
                <rmic  verify="true" debug="on" base="${project.build.outputDirectory}">
....
                </rmic>
              </tasks>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>


> classpath related error when invoking the rmic task from maven
> --------------------------------------------------------------
>
>          Key: MNG-1334
>          URL: http://jira.codehaus.org/browse/MNG-1334
>      Project: Maven 2
>         Type: Bug

>   Components: maven-antrun-plugin
>     Versions: 2.0
>  Environment: OpenSuSE 10, JDK1.5, Maven 2.0
>     Reporter: Rohnny Moland (JIRA)
>     Assignee: Brett Porter

>
>
> When invoking the rmic task from maven, I get this error message:
> "Cannot use SUN rmic, as it is not available.  A common solution is to
> set the environment variable JAVA_HOME or CLASSPATH." 
> Invoking the rmic task from ant works fine. So it must be a classpath problem when using ant embedded in maven.

-- 
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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


[jira] Commented: (MNG-1334) classpath related error when invoking the rmic task from maven

Posted by "Rohnny Moland (JIRA) (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MNG-1334?page=comments#action_49386 ] 

Rohnny Moland (JIRA) commented on MNG-1334:
-------------------------------------------

Seems like the antrun plugin cant see the jdk but instead uses the jre, even if java home is pointing at the
jdk. The quick solution was to copy tools.jar into jre/lib/ext. Well. 


> classpath related error when invoking the rmic task from maven
> --------------------------------------------------------------
>
>          Key: MNG-1334
>          URL: http://jira.codehaus.org/browse/MNG-1334
>      Project: Maven 2
>         Type: Bug
>   Components: maven-antrun-plugin
>     Versions: 2.0
>  Environment: OpenSuSE 10, JDK1.5, Maven 2.0
>     Reporter: Rohnny Moland (JIRA)

>
>
> When invoking the rmic task from maven, I get this error message:
> "Cannot use SUN rmic, as it is not available.  A common solution is to
> set the environment variable JAVA_HOME or CLASSPATH." 
> Invoking the rmic task from ant works fine. So it must be a classpath problem when using ant embedded in maven.

-- 
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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


[jira] Commented: (MNG-1334) classpath related error when invoking the rmic task from maven

Posted by "Rohnny Moland (JIRA) (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MNG-1334?page=comments#action_53269 ] 

Rohnny Moland (JIRA) commented on MNG-1334:
-------------------------------------------

Yes, I know. Its just to add tools.jar to the maven classpath, as Brett Porter commented for over a month ago. But thanks anyway.


> classpath related error when invoking the rmic task from maven
> --------------------------------------------------------------
>
>          Key: MNG-1334
>          URL: http://jira.codehaus.org/browse/MNG-1334
>      Project: Maven 2
>         Type: Bug

>   Components: maven-antrun-plugin
>     Versions: 2.0
>  Environment: OpenSuSE 10, JDK1.5, Maven 2.0
>     Reporter: Rohnny Moland (JIRA)
>     Assignee: Brett Porter

>
>
> When invoking the rmic task from maven, I get this error message:
> "Cannot use SUN rmic, as it is not available.  A common solution is to
> set the environment variable JAVA_HOME or CLASSPATH." 
> Invoking the rmic task from ant works fine. So it must be a classpath problem when using ant embedded in maven.

-- 
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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


[jira] Closed: (MNG-1334) classpath related error when invoking the rmic task from maven

Posted by "Brett Porter (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MNG-1334?page=all ]
     
Brett Porter closed MNG-1334:
-----------------------------

     Assign To: Brett Porter
    Resolution: Won't Fix

<dependency>
  ...
  <systemPath>${java.home}/lib/tools.jar</systemPath>
</dependency>

can be added to the antrun plugin

> classpath related error when invoking the rmic task from maven
> --------------------------------------------------------------
>
>          Key: MNG-1334
>          URL: http://jira.codehaus.org/browse/MNG-1334
>      Project: Maven 2
>         Type: Bug
>   Components: maven-antrun-plugin
>     Versions: 2.0
>  Environment: OpenSuSE 10, JDK1.5, Maven 2.0
>     Reporter: Rohnny Moland (JIRA)
>     Assignee: Brett Porter

>
>
> When invoking the rmic task from maven, I get this error message:
> "Cannot use SUN rmic, as it is not available.  A common solution is to
> set the environment variable JAVA_HOME or CLASSPATH." 
> Invoking the rmic task from ant works fine. So it must be a classpath problem when using ant embedded in maven.

-- 
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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org