[ 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to