Bug 379530 - LT should be able to explore WAR or EAR file type by itself
Summary: LT should be able to explore WAR or EAR file type by itself
Status: NEW
Alias: None
Product: AspectJ
Classification: Tools
Component: LTWeaving (show other bugs)
Version: 1.6.12   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-15 08:02 EDT by Jorelia CLA
Modified: 2012-05-18 13:42 EDT (History)
0 users

See Also:


Attachments
The famous Workbench - A Sample WAR (97.39 KB, application/octet-stream)
2012-05-15 08:13 EDT, Jorelia CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jorelia CLA 2012-05-15 08:02:17 EDT
Build Identifier: AJDT version: 2.1.3.e37x-20110628-1900 for Eclipse 3.7 /   AspectJ Compiler version: 1.6.12.M1

It is feature request rather than a bug.

Actually we got many exception when we do a binary weawing via ANT/IAJC. We want to weave a WAR which is included into a EAR. The EAR can contain many WAR. But, for the moment, let talk only about the WAR.

Actually we got many exception when we want to weave a WAR, just because some classes are not found. Our syntax is something like this:

   iajc  -inpath CrmWeb_origine.war   -outJar CrmWeb.war  -showWeaveInfo

However, the weaver is not able to find some classes even if the jar files which contain those classes are inside the WAR at the folder WEB-INF/lib.

As the structure of a WAR file is well known as well as for a EAR file, is it possible, based at least on the extension file, to have an automatic scanning for those folders "lib" inside WEB-INF, or META-INF\MANIFEST.MF for the classpath in order to avoid having classpath problem ?

If the WAR or the EAR contain some libraries, the weaver should find them based on some convention such as normalized structure folder.



Reproducible: Always

Steps to Reproduce:
1. Just build a WAR file with an aspect
2. And perform a binary weaving from the WAR to the same WAR.
3. like : iajc  -inpath CrmWeb_origine.war  -outJar CrmWeb.war  -showWeaveInfo
   (but syntax is not exact).
Comment 1 Jorelia CLA 2012-05-15 08:06:08 EDT
More over, could you please give some example in AspectJ documentation about weaving a EAR or WAR file with binary weaving ?
Comment 2 Jorelia CLA 2012-05-15 08:13:58 EDT
Created attachment 215632 [details]
The famous Workbench - A Sample WAR

This is the workbench - Andy know it. Please read the readme file to know how to build the workbench. It is a WAR file with @AspectJ classes.

To construct a EAR file, create a new JAVA Enterprise project and include the WAR into the EAR. Add also a lib folder for testing purpose. The weaver should be able to dig also into the lib of the EAR file too.
Comment 3 Jorelia CLA 2012-05-15 08:17:20 EDT
EAR / WAR  Format: http://en.wikipedia.org/wiki/EAR_%28file_format%29

In our specific case, our EAR file contains a lib directory. So we should have a way to specify the internal classpath for an EAR and/or adopt a convention.
Comment 4 Jorelia CLA 2012-05-18 13:20:53 EDT
A last word, actually we have also some difficulties, because when we try to weave a WAR file, the weaver creates a new folder at the root of the WAR com.cpny.appname.folders... and leaves the folders under WEB-INF\classes\ completly empty. There are no .class files.

Based on the extension files or based on structure recognition, (having or not having WEB-INF\lib) we can avoid to specify manually a bunch of classpath. It wil make easier our life.


<code>
   <iajc inpath="Web_origine.war" 
                    outjar="Web.war" 
                 showWeaveInfo="true">         
   <classpath> 
     <pathelement path = "ext/aspectjrt.jar"/> 
     <pathelement path = "ext/javax.faces.jar"/> 
     <pathelement path = "ext/annotations-4.2.0.Final.jar"/> 
     <pathelement path = "ext/antlr-2.7.6.jar"/> 
     <pathelement path = "ext/cglib-nodep-2.2.2.jar"/> 
     <pathelement path = "ext/cof-service-api-official.jar"/> 
     <pathelement path = "ext/cof-service-web-official.jar"/> 
     <pathelement path = "ext/common-api-core-official.jar"/> 
     <pathelement path = "ext/common-api-dm-official.jar"/> 
     <pathelement path = "ext/common-api-email-official.jar"/> 
     <pathelement path = "ext/common-api-il-services-official.jar"/> 
     <pathelement path = "ext/common-api-java-services-official.jar"/> 
     <pathelement path = "ext/common-api-moneris-official.jar"/> 
     <pathelement path = "ext/common-api-pega-services-official.jar"/> 
     <pathelement path = "ext/common-api-web-official.jar"/> 
     <pathelement path = "ext/common-api-web-struts-official.jar"/> 
     <pathelement path = "ext/common-api-web-tags-official.jar"/> 
     <pathelement path = "ext/common-api-wi-official.jar"/> 
     <pathelement path = "ext/commons-lang-2.4.jar"/> 
     <pathelement path = "ext/commons-logging-1.1.1.jar"/> 
     <pathelement path = "ext/commons-validator-1.4.0.jar"/> 
     <pathelement path = "ext/cssparser-0.9.6.jar"/> 
     <pathelement path = "ext/dom4j-1.6.1.jar"/> 
     <pathelement path = "ext/guava-11.0.1.jar"/> 
     <pathelement path = "ext/hibernate-3.3.2.jar"/> 
     <pathelement path = "ext/hibernate-annotations-3.4.0.jar"/> 
     <pathelement path = "ext/hibernate-commons-annotations-3.4.0.jar"/> 
     <pathelement path = "ext/hibernate-entitymanager-3.4.0.jar"/> 
     <pathelement path = "ext/hibernate-validator-4.2.0.Final.jar"/>                           
     <pathelement path = "ext/junit-4.10.jar"/> 
     <pathelement path = "ext/log4j-1.2.16.jar"/> 
     <pathelement path = "ext/ojdbc14-10.2.0.4.jar"/> 
     <pathelement path = "ext/org.springframework.asm-3.0.6.RELEASE.jar"/> 
     <pathelement path = "ext/org.springframework.beans-3.0.6.RELEASE.jar"/> 
     <pathelement path = "ext/org.springframework.context-3.0.6.RELEASE.jar"/> 
     <pathelement path = "ext/org.springframework.core-3.0.6.RELEASE.jar"/> 
     <pathelement path = "ext/org.springframework.expression-3.0.6.RELEASE.jar"/> 
     <pathelement path = "ext/org.springframework.jdbc-3.0.6.RELEASE.jar"/> 
     <pathelement path = "ext/org.springframework.orm-3.0.6.RELEASE.jar"/> 
     <pathelement path = "ext/org.springframework.transaction-3.0.6.RELEASE.jar"/> 
     <pathelement path = "ext/org.springframework.web-3.0.6.RELEASE.jar"/> 
     <pathelement path = "ext/pop-api-official.jar"/> 
     <pathelement path = "ext/pop-services-official.jar"/> 
     <pathelement path = "ext/richfaces-components-api-4.2.0.Final.jar"/> 
     <pathelement path = "ext/richfaces-components-ui-4.2.0.Final.jar"/> 
     <pathelement path = "ext/richfaces-core-api-4.2.0.Final.jar"/> 
     <pathelement path = "ext/richfaces-core-impl-4.2.0.Final.jar"/> 
     <pathelement path = "ext/sac-1.3.jar"/> 
     <pathelement path = "ext/slf4j-api-1.6.4.jar"/> 
     <pathelement path = "ext/slf4j-log4j12-1.6.4.jar"/> 
     <pathelement path = "ext/j2ee.jar"/> 
     <pathelement path = "ext/commons-collections-3.2.1.jar"/> 
     <pathelement path = "ext/org.springframework.aop-3.0.6.RELEASE.jar"/>                           
     </classpath> 
  </iajc>
<code>
Comment 5 Jorelia CLA 2012-05-18 13:42:17 EDT
To summarize :

  Weaver/compiler should handle different types of "jar" files based on:
      - extension file (jar, war, ear)
      - "jar" file has an WEB-INF\lib directory
      - "jar" file has a lib directory (directories...)
      - Take in account the Maven convention for EAR / WAR standard structure
      - Take in account the EAR / WAR java EE structure specification
      - Take in account the Manifest.MF file
      - Take in account multi-project EAR (an EAR with more than one WAR file)

  Based on this structure knowledge, the Weaver/compiler should find the necessary
  files (jar) in order to be able to weave/compile the aspects. Other dependency can be added by the classic way.

  The weaver/compiler MUST produce a new EAR/WAR without changing the structure of the EAR/WAR. It is like a compile/weave and replace .class files.

  User should be give to the weaver a target as a based directory when the weaver cannot recognized any standard-well-know structure. When a user specify this target based directory, this directive has precedence on any other file structure recognition.
  
 When the file is a EAR or a WAR, it means it is a Java EE project and then the j2ee.jar should be added automatically. If the user specify the jar manually, the user choice has the precedence.

All of that in order to make the compiling/weaving,   transparent, lightweight and more friendly for all of us and also to increase the interoperability between java community and technologies.

This is an important requirement that should be considered as soon as you can.

Best regards,

JA