title: Let eclipse use maven to compile/weave my code
body: <p>I am using compile time weaving with aspectj to weave in Spring's transactional code so I can use <code>@Transactional</code>. When i run maven compile from inside Eclipse (which uses the aspectj-maven-plugin), eclipse synchronizes to the tomcat server and all goes well.</p>
  
  <p>But when Eclipse compiles (project->build automatically) it appears not to weave the spring transactional code and I get this error:</p>
  
  <pre><code>javax.persistence.TransactionRequiredException: no transaction is in progress
  </code></pre>
  
  <p>This is very annoying because I just want to code away and not manually call maven compile after eclipse compiles every time.</p>
  
  <p>Do I need to edit the Aspect Path or inPath of the AJDT plugin? Why doesn't Eclipse just use maven to build?</p>
  
  <hr>
  
  <p>I am using:</p>
  
  <ul>
  <li>Eclipse WTP Indigo</li>
  <li>Spring 3.0.5.Release</li>
  <li>JDK7 &amp; Tomcat 7</li>
  <li>m2eclipse &amp; AJDT plugins</li>
  </ul>
  
  <p>These are the relevant fragments of my pom.xml:</p>
  
  <pre><code>&lt;!-- AspectJ --&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.aspectj&lt;/groupId&gt;
      &lt;artifactId&gt;aspectjtools&lt;/artifactId&gt;
      &lt;version&gt;1.6.11&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.aspectj&lt;/groupId&gt;
      &lt;artifactId&gt;aspectjweaver&lt;/artifactId&gt;
      &lt;version&gt;1.6.11&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.springframework&lt;/groupId&gt;
      &lt;artifactId&gt;org.springframework.aspects&lt;/artifactId&gt;
      &lt;version&gt;${spring.version}&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.springframework&lt;/groupId&gt;
      &lt;artifactId&gt;spring-aspects&lt;/artifactId&gt;
      &lt;version&gt;${spring.version}&lt;/version&gt;
      &lt;scope&gt;compile&lt;/scope&gt;
  &lt;/dependency&gt;
  
  &lt;!-- Compile time weaving --&gt;
  &lt;plugin&gt;
      &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
      &lt;artifactId&gt;aspectj-maven-plugin&lt;/artifactId&gt;
      &lt;executions&gt;
          &lt;execution&gt;
              &lt;id&gt;compile&lt;/id&gt;
              &lt;configuration&gt;
                  &lt;source&gt;1.6&lt;/source&gt;
                  &lt;target&gt;1.6&lt;/target&gt;
                  &lt;verbose&gt;true&lt;/verbose&gt;
                  &lt;outxml&gt;true&lt;/outxml&gt;
                  &lt;aspectLibraries&gt;
                      &lt;aspectLibrary&gt;
                          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
                          &lt;artifactId&gt;spring-aspects&lt;/artifactId&gt;
                      &lt;/aspectLibrary&gt;
                  &lt;/aspectLibraries&gt;
              &lt;/configuration&gt;
              &lt;goals&gt;
                  &lt;goal&gt;compile&lt;/goal&gt;
              &lt;/goals&gt;
          &lt;/execution&gt;
          &lt;!-- omitted test-compile part --&gt;
      &lt;/executions&gt;
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.aspectj&lt;/groupId&gt;
              &lt;artifactId&gt;aspectjweaver&lt;/artifactId&gt;
              &lt;version&gt;1.6.11&lt;/version&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  &lt;/plugin&gt;
  </code></pre>