Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] AJDT vs Java Builder confusion

I made a little example and it worked well... the only difference was that I added the org.codehaus.mojo:aspectj-maven-plugin:1.4 plugin to the pom.xml because it's needed by the maven-eclipse-plugin to activate the AJDT configurations (See this method on the source of the eclipse:eclipse mojo here).
If you don't add this plugin, the ajbuilder, the ajnature and the ASPECTJRT_CONTAINER variable will not be added.

These were the command that I used:

1) mvn archetype:generate -DinteractiveMode=false -DgroupId=com.tests -DartifactId=ajdt-test
2) cd ajdt-test
3) Add these lines in pom.xml:

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-eclipse-plugin</artifactId>
                <version>2.9</version>
                <configuration>
                    <wtpversion>2.0</wtpversion>
                    <wtpapplicationxml>true</wtpapplicationxml>
                    <downloadSources>true</downloadSources>
                    <downloadJavadoc>true</downloadJavadoc>
                    <useProjectReferences>true</useProjectReferences>
                    <ajdtVersion>1.6</ajdtVersion>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>aspectj-maven-plugin</artifactId>
                <version>1.4</version>
            </plugin>
        </plugins>
    </build>

4) mvn eclipse:clean eclipse:eclipse

The output:

.project

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
  <name>ajdt-test</name>
  <comment>NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment>
  <projects/>
  <buildSpec>
    <buildCommand>
      <name>org.eclipse.ajdt.core.ajbuilder</name>
    </buildCommand>
    <buildCommand>
      <name>org.eclipse.wst.common.project.facet.core.builder</name>
    </buildCommand>
    <buildCommand>
      <name>org.eclipse.wst.validation.validationbuilder</name>
    </buildCommand>
  </buildSpec>
  <natures>
    <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
    <nature>org.eclipse.ajdt.ui.ajnature</nature>
    <nature>org.eclipse.jdt.core.javanature</nature>
    <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
    <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
  </natures>
</projectDescription>

.classpath

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
  <classpathentry kind="src" path="src/test/java" output="target/test-classes" including="**/*.java|**/*.aj"/>
  <classpathentry kind="src" path="src/main/java" including="**/*.java|**/*.aj"/>
  <classpathentry kind="output" path="target/classes"/>
  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
  <classpathentry kind="con" path="org.eclipse.ajdt.core.ASPECTJRT_CONTAINER"/>
  <classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar" sourcepath="M2_REPO/junit/junit/3.8.1/junit-3.8.1-sources.jar"/>
</classpath>

Hope this help
Martin

On Sat, Mar 10, 2012 at 6:48 PM, Kristof Jozsa <kristof.jozsa@xxxxxxxxx> wrote:
Here it goes:

     <plugin>
       <groupId>org.apache.maven.plugins</groupId>
       <artifactId>maven-eclipse-plugin</artifactId>
       <version>2.9</version>
       <configuration>
         <wtpversion>2.0</wtpversion>
         <wtpapplicationxml>true</wtpapplicationxml>
         <downloadSources>true</downloadSources>
         <downloadJavadoc>true</downloadJavadoc>
         <useProjectReferences>true</useProjectReferences>
         <ajdtVersion>1.6</ajdtVersion>
       </configuration>
     </plugin>

K

On Sat, Mar 10, 2012 at 5:47 PM, Andrew Eisenberg <andrew@xxxxxxxxxxxx> wrote:
> You can paste the snippet of the pom that corresponds to your eclipse
> plugin configuration.  I don't know if I'll be able to find anything,
> but I can have a look.  Maybe someone else on this list knows more
> about it.
>
> On Sat, Mar 10, 2012 at 1:42 AM, Kristof Jozsa <kristof.jozsa@xxxxxxxxx> wrote:
>> Thanks, right as I suspected. Now if I only knew why on earth `mvn
>> eclipse:clean eclipse:eclipse` now introduces both builders into
>> projects.. interesting, to say at least.
>>
>> K
>>
>> On Fri, Mar 9, 2012 at 5:25 PM, Andrew Eisenberg <andrew@xxxxxxxxxxxx> wrote:
>>> There should not be any Java builder in AspectJ projects. Only an AJ builder.
>>>
>>> On Fri, Mar 9, 2012 at 4:47 AM, Kristof Jozsa <kristof.jozsa@xxxxxxxxx> wrote:
>>>> Hi,
>>>>
>>>> please help me clarifying an issue: on a properly configured AJDT
>>>> project, should the Java Builder be also enabled?
>>>>
>>>> I always used `mvn eclipse:eclipse` to generate my Eclipse
>>>> configuration and a proper pom setup ensured that Eclipse has it all
>>>> working too. Today however, my Eclipse 3.7.2 started to compile errors
>>>> for all my aspects and appearently, both the AspectJ Builder and the
>>>> Java Builder became enabled on my projects. I guess that's not how
>>>> it's meant to be, right?
>>>>
>>>> thanks,
>>>> K
>>>> _______________________________________________
>>>> aspectj-users mailing list
>>>> aspectj-users@xxxxxxxxxxx
>>>> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>>> _______________________________________________
>>> aspectj-users mailing list
>>> aspectj-users@xxxxxxxxxxx
>>> https://dev.eclipse.org/mailman/listinfo/aspectj-users
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users


Back to the top