10 Replies Latest reply on Feb 22, 2010 1:55 PM by Denis Golovin

    Problem activating "PROJECT ARCHIVES" from ANT

    Kobi Ianko Apprentice

      Hi,

      I've created a new JAR with Project Archives, and by clicking right-click Build Project(Full) it creates the JAR as expected.

       

      But, I need it to run it from ANT Build, and not by Eclipse GUI mouse clicking.

      I've tried useing this ANT task:

       

      <property name="studio.home" location="${eclipse.home}/../studio/eclipse"/>

      <path id="generate-archives-classpath">
        <fileset dir="${eclipse.home}/plugins">
         <include name="org.eclipse.equinox.common_*.jar"/>                                   
        </fileset>
        <fileset dir="${studio.home}">
         <include name="plugins/org.jboss.ide.eclipse.archives.core**/archivescore.jar"/>
         <include name="plugins/org.jboss.ide.eclipse.archives.core**/lib/*.jar"/>        
        </fileset>
      </path>
                      
      <taskdef name="generate-archives" classpathref="generate-archives-classpath"      
      classname="org.jboss.ide.eclipse.archives.core.ant.GenerateArchivesTask"/>
              
      <target name="run-packaging">
      <!-- each project needs to have their root dir defined when running outside eclipse -->
      <property name="pojp.dir" value="C:/Users/max/workspace/pojp"/>
      <generate-archives projectPath="C:/Users/max/workspace/pojp"/>
      </target>

      this task causes an error, and the JAR file is not built.
      the error is:
      Error adding child node myJar.jar
      [GenerateArchives] org.jboss.ide.eclipse.archives.core.model.ArchivesModelException: Error adding child node myJar.jar
      [GenerateArchives]      at org.jboss.ide.eclipse.archives.core.model.internal.ArchiveNodeImpl.addChild(ArchiveNodeImpl.java:273)
      [GenerateArchives]      at org.jboss.ide.eclipse.archives.core.util.ModelUtil.fillArchiveModel(ModelUtil.java:216)
      [GenerateArchives]      at org.jboss.ide.eclipse.archives.core.model.ArchivesModel.registerProject(ArchivesModel.java:194)
      [GenerateArchives]      at org.jboss.ide.eclipse.archives.core.model.ArchivesModel.registerProject(ArchivesModel.java:170)
      [GenerateArchives]      at org.jboss.ide.eclipse.archives.core.ant.GenerateArchivesTask.execute(GenerateArchivesTask.java:63)
      [GenerateArchives]      at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
      [GenerateArchives]      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      [GenerateArchives]      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      [GenerateArchives]      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      [GenerateArchives]      at java.lang.reflect.Method.invoke(Unknown Source)
      [GenerateArchives]      at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
      [GenerateArchives]      at org.apache.tools.ant.Task.perform(Task.java:348)
      [GenerateArchives]      at org.apache.tools.ant.Target.execute(Target.java:357)
      [GenerateArchives]      at org.apache.tools.ant.Target.performTasks(Target.java:385)
      [GenerateArchives]      at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
      [GenerateArchives]      at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
      [GenerateArchives]      at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
      [GenerateArchives]      at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
      [GenerateArchives]      at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
      [GenerateArchives]      at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
      [GenerateArchives]      at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)


      my using:
      Eclipse Version: 3.4.2 Build id: M20090211-1700
      JBoss Tools 3.0.3GA
      windows 7, 32bit.

      10x, Kobi