0

My System Information:

IDE:    Eclipse Blue 10.0, 
Server: Websphere 7.0
Build Management Tool: Maven 3.0

I perform compile time weaving in my Maven project using below configuration:

<properties>    
        <maven.compiler.source>1.6</maven.compiler.source>
        <maven.compiler.target>1.6</maven.compiler.target>
    </properties>
    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>aspectj-maven-plugin</artifactId>
                <version>1.4</version>
                <executions>
                        <execution>
                            <goals>
                                <goal>compile</goal>
                                <!-- <goal>test-compile</goal> -->
                            </goals>
                        </execution>
                </executions>                
                <configuration>
                    <aspectLibraries>
                        <aspectLibrary>
                            <groupId>com.xxx.logger</groupId>
                            <artifactId>my-aspect-logger</artifactId>
                        </aspectLibrary>
                    </aspectLibraries>                  
                    <showWeaveInfo>true</showWeaveInfo>
                    <outxml>true</outxml>                   
                    <Xlint>warning</Xlint>
                    <verbose>true</verbose>
                    <source>${maven.compiler.source}</source>
                    <target>${maven.compiler.target}</target>
                </configuration>                
            </plugin>            
         </plugins>
     </build>

During development, I use to add my EAR file in exploded mode in Eclipse itself by following below path:

Windows > Show View > Servers > WebSphere 7 > Right Click > Add Deployment 

I am facing one issue that whenever I change my java classes those are compiled and hot deployed in server. But, they are not re-weaved. But if I remove the EAR, build my project from command prompt and re-deploy it then it works properly.

Can somebody please help me to resolve this issue.

Narendra Verma
  • 2,372
  • 6
  • 34
  • 61

1 Answers1

0

I'm not familiar with AspectJ but MyEclipse does not execute maven goals to build and deploy projects (though you can add builders, which may invoke maven externally - note that the Maven Project Builder doesn't execute Maven goals), so processing specified in your pom will not be executed automatically, though, obviously, you can run maven goals from the Run As menu item. So changed Java classes will be recompiled using the configured JRE and redeployed. Any additional processing specified in the pom will not be run. However, you say that removing the deployment and then re-deploying actually works, so I'm not sure how the re-weaving gets done, if you don't execute a maven build before redeployment.

Tony Weddle
  • 2,081
  • 1
  • 11
  • 15
  • I have corrected my statement "But if I remove the EAR, build my project from command prompt and re-deploy it then it works properly". Is there any way to define that whenever I change my code in eclipse, maven goals should be executed before hot deployment. So that my code can be weaved as per configuration mentioned in pom.xml? – Narendra Verma Mar 27 '13 at 07:21
  • Sorry, I missed this comment. You should explore the possibility of adding a builder (right click on the project, select Properties and then Builders). You can create a new Ant builder, run an external program (e.g. maven) or import a launch configuration (which could probably be a maven launch configuration) from your workspace. This is a standard eclipse feature so you might be able to find information on doing this at an eclipse focused site. – Tony Weddle Apr 16 '13 at 08:23