Announcement Announcement Module
Collapse
No announcement yet.
class file in jar missing roo generated methods Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • class file in jar missing roo generated methods

    I have an build problem where a roo managed file is ending up in the final jar missing it's roo generated methods.
    It's inconsistent between my build server, and yet consistent within builds on each server. IOW, if a build env is getting it wrong, it's always wrong.

    The disassembled 'bad' class file contains:

    Code:
    public class Coupon extends Campaign
    {
    
      @DateTimeFormat(style="SL")
      private Calendar expiresOn;
      BigInteger maxRedemptions;
      BigInteger numberOfCodes;
    
      public Coupon()
      {
        JoinPoint localJoinPoint = Factory.makeJP(ajc$tjp_2, this, this); if ((!AnnotationBeanConfigurerAspect.ajc$if$bb0((Configurable)getClass().getAnnotation(Configurable.class))) && (AbstractDependencyInjectionAspect.ajc$if$6f1(localJoinPoint))) AnnotationBeanConfigurerAspect.aspectOf().ajc$afterReturning$org_springframework_beans_factory_aspectj_AbstractDependencyInjectionAspect$2$1ea6722c(this);
      }
    
      public static Coupon findCouponBySeries(String series)
      {
        String str = series; JoinPoint localJoinPoint = Factory.makeJP(ajc$tjp_0, null, null, str); if ((AnnotationDrivenStaticEntityMockingControl.ajc$cflowCounter$1.isValid()) && (AnnotationDrivenStaticEntityMockingControl.hasAspect())) return (Coupon)findCouponBySeries_aroundBody1$advice(str, localJoinPoint, AnnotationDrivenStaticEntityMockingControl.aspectOf(), null, ajc$tjp_0, localJoinPoint); return findCouponBySeries_aroundBody0(str, localJoinPoint); } 
      public static List<Coupon> findActiveCouponsByPartner(Partner partner) { Partner localPartner = partner; JoinPoint localJoinPoint = Factory.makeJP(ajc$tjp_1, null, null, localPartner); if ((AnnotationDrivenStaticEntityMockingControl.ajc$cflowCounter$1.isValid()) && (AnnotationDrivenStaticEntityMockingControl.hasAspect())) return (List)findActiveCouponsByPartner_aroundBody3$advice(localPartner, localJoinPoint, AnnotationDrivenStaticEntityMockingControl.aspectOf(), null, ajc$tjp_1, localJoinPoint); return findActiveCouponsByPartner_aroundBody2(localPartner, localJoinPoint); } 
      static { ajc$preClinit();
      }
    }
    whereas the 'good' disassembled class file has:

    Code:
    import java.math.BigInteger;
    import java.util.Calendar;
    import java.util.List;
    import javax.persistence.Entity;
    import javax.persistence.TypedQuery;
    import org.aspectj.lang.JoinPoint;
    import org.aspectj.runtime.internal.CFlowCounter;
    import org.aspectj.runtime.reflect.Factory;
    import org.springframework.beans.factory.annotation.Configurable;
    import org.springframework.beans.factory.aspectj.AbstractDependencyInjectionAspect;
    import org.springframework.beans.factory.aspectj.AnnotationBeanConfigurerAspect;
    import org.springframework.format.annotation.DateTimeFormat;
    import org.springframework.mock.staticmock.AnnotationDrivenStaticEntityMockingControl;
    
    @Entity
    @Configurable
    public class Coupon extends Campaign
    {
    
      @DateTimeFormat(style="SL")
      private Calendar expiresOn;
      BigInteger maxRedemptions;
      BigInteger numberOfCodes;
    
      public Coupon()
      {
        JoinPoint localJoinPoint = Factory.makeJP(ajc$tjp_2, this, this); if ((!AnnotationBeanConfigurerAspect.ajc$if$bb0((Configurable)getClass().getAnnotation(Configurable.class))) && (AbstractDependencyInjectionAspect.ajc$if$6f1(localJoinPoint))) AnnotationBeanConfigurerAspect.aspectOf().ajc$afterReturning$org_springframework_beans_factory_aspectj_AbstractDependencyInjectionAspect$2$1ea6722c(this);
      }
    
      public static Coupon findCouponBySeries(String series)
      {
        String str = series; JoinPoint localJoinPoint = Factory.makeJP(ajc$tjp_0, null, null, str); if ((AnnotationDrivenStaticEntityMockingControl.ajc$cflowCounter$1.isValid()) && (AnnotationDrivenStaticEntityMockingControl.hasAspect())) return (Coupon)findCouponBySeries_aroundBody1$advice(str, localJoinPoint, AnnotationDrivenStaticEntityMockingControl.aspectOf(), null, ajc$tjp_0, localJoinPoint); return findCouponBySeries_aroundBody0(str, localJoinPoint); } 
      public static List<Coupon> findActiveCouponsByPartner(Partner partner) { Partner localPartner = partner; JoinPoint localJoinPoint = Factory.makeJP(ajc$tjp_1, null, null, localPartner); if ((AnnotationDrivenStaticEntityMockingControl.ajc$cflowCounter$1.isValid()) && (AnnotationDrivenStaticEntityMockingControl.hasAspect())) return (List)findActiveCouponsByPartner_aroundBody3$advice(localPartner, localJoinPoint, AnnotationDrivenStaticEntityMockingControl.aspectOf(), null, ajc$tjp_1, localJoinPoint); return findActiveCouponsByPartner_aroundBody2(localPartner, localJoinPoint); } 
      static { ajc$preClinit(); } 
      public static long countCoupons() { return Coupon_Roo_Entity.ajc$interMethod$com_nim_domain_campaign_Coupon_Roo_Entity$com_nim_domain_campaign_Coupon$countCoupons(); } 
      public static List<Coupon> findAllCoupons() { return Coupon_Roo_Entity.ajc$interMethod$com_nim_domain_campaign_Coupon_Roo_Entity$com_nim_domain_campaign_Coupon$findAllCoupons(); } 
      public static Coupon findCoupon(Long paramLong) { return Coupon_Roo_Entity.ajc$interMethod$com_nim_domain_campaign_Coupon_Roo_Entity$com_nim_domain_campaign_Coupon$findCoupon(paramLong); } 
      public static List<Coupon> findCouponEntries(int paramInt1, int paramInt2) { return Coupon_Roo_Entity.ajc$interMethod$com_nim_domain_campaign_Coupon_Roo_Entity$com_nim_domain_campaign_Coupon$findCouponEntries(paramInt1, paramInt2); } 
      public static TypedQuery<Coupon> findCouponsBySeries(String paramString) { return Coupon_Roo_Finder.ajc$interMethod$com_nim_domain_campaign_Coupon_Roo_Finder$com_nim_domain_campaign_Coupon$findCouponsBySeries(paramString); } 
      public Calendar getExpiresOn() { return Coupon_Roo_JavaBean.ajc$interMethod$com_nim_domain_campaign_Coupon_Roo_JavaBean$com_nim_domain_campaign_Coupon$getExpiresOn(this); } 
      public BigInteger getMaxRedemptions() { return Coupon_Roo_JavaBean.ajc$interMethod$com_nim_domain_campaign_Coupon_Roo_JavaBean$com_nim_domain_campaign_Coupon$getMaxRedemptions(this); } 
      public BigInteger getNumberOfCodes() { return Coupon_Roo_JavaBean.ajc$interMethod$com_nim_domain_campaign_Coupon_Roo_JavaBean$com_nim_domain_campaign_Coupon$getNumberOfCodes(this); } 
      public void setExpiresOn(Calendar paramCalendar) { Coupon_Roo_JavaBean.ajc$interMethod$com_nim_domain_campaign_Coupon_Roo_JavaBean$com_nim_domain_campaign_Coupon$setExpiresOn(this, paramCalendar); } 
      public void setMaxRedemptions(BigInteger paramBigInteger) { Coupon_Roo_JavaBean.ajc$interMethod$com_nim_domain_campaign_Coupon_Roo_JavaBean$com_nim_domain_campaign_Coupon$setMaxRedemptions(this, paramBigInteger); } 
      public void setNumberOfCodes(BigInteger paramBigInteger) { Coupon_Roo_JavaBean.ajc$interMethod$com_nim_domain_campaign_Coupon_Roo_JavaBean$com_nim_domain_campaign_Coupon$setNumberOfCodes(this, paramBigInteger); } 
      public String toString() { return Coupon_Roo_ToString.ajc$interMethod$com_nim_domain_campaign_Coupon_Roo_ToString$com_nim_domain_campaign_Coupon$toString(this);
      }
    }
    Within the build tree itself, the original class file is OK, it's only when it's picked up as a dependency in a peer module that it gets truncated. Also not all peer modules are truncating it, only one is.

    Can anyone offer any insight as to what could possibly be causing the exclusion of the roo generated methods?

    -Stumped

  • #2
    The problem turned out to be a maven issue.
    The aspectj weaving was not consistently happening before the jar packaging.
    Adding the following bold line to my top level pom fixed it for all affected environments.


    Code:
    				<plugin>
    					<groupId>org.codehaus.mojo</groupId>
    					<artifactId>aspectj-maven-plugin</artifactId>
    					<version>1.3</version>
    					<dependencies>
    						<!-- NB: You must use Maven 2.0.9 or above or these are ignored (see 
    							MNG-2972) -->
    						<dependency>
    							<groupId>org.aspectj</groupId>
    							<artifactId>aspectjrt</artifactId>
    							<version>${aspectj.version}</version>
    						</dependency>
    						<dependency>
    							<groupId>org.aspectj</groupId>
    							<artifactId>aspectjtools</artifactId>
    							<version>${aspectj.version}</version>
    						</dependency>
    					</dependencies>
    					<executions>
    						<execution>
    							<goals>
    								<goal>compile</goal>
    								<goal>test-compile</goal>
    							</goals>
    	                                                <phase>process-sources</phase>
    						</execution>

    Comment

    Working...
    X