Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] How to compile interfaces with default implementations

Hello everyone

I'm reading AspectJ in Action (2nd edition) and downloaded the source
code from http://www.manning.com/laddad2/AspectJInActionSecondEdition-sources-1.0.0.zip.
I'm now trying to compile the project
"ch05\workspace\Section5.1.5ExampleVersion2". It's about interfaces
that have a default implementation like:

public interface Nameable {
	public void setName(String name);
	public String getName();
	
	static aspect Impl {
	private String Nameable.name;
		public void Nameable.setName(String name) {
			this.name = name;
		}
		public String Nameable.getName() {
			return this.name;
		}
	}
}

When compiling the project, I get compilation errors:

8<--------------------------------------------------------------------------------------------------------

[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective
model for ajia:section5.1.5ExampleVersion2:jar:1.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for
org.codehaus.mojo:tomcat-maven-plugin is missing. @
ajia:common-java:1.0-SNAPSHOT,
C:\Users\james\.m2\repository\ajia\common-java\1.0-SNAPSHOT\common-java-1.0-SNAPSHOT.pom,
line 371, column 12
[WARNING] 'build.plugins.plugin.version' for
org.apache.maven.plugins:maven-compiler-plugin is missing. @
ajia:common-java:1.0-SNAPSHOT,
C:\Users\james\.m2\repository\ajia\common-java\1.0-SNAPSHOT\common-java-1.0-SNAPSHOT.pom,
line 327, column 12
[WARNING] 'build.plugins.plugin.version' for
org.codehaus.mojo:exec-maven-plugin is missing. @
ajia:common-java:1.0-SNAPSHOT,
C:\Users\james\.m2\repository\ajia\common-java\1.0-SNAPSHOT\common-java-1.0-SNAPSHOT.pom,
line 356, column 12
[WARNING] 'build.plugins.plugin.version' for
org.codehaus.mojo:aspectj-maven-plugin is missing. @ line 16, column
12
[WARNING]
[WARNING] It is highly recommended to fix these problems because they
threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer
support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building section5.1.5ExampleVersion2 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.4.3:resources (default-resources)
@ section5.1.5ExampleVersion2 ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered
resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory
D:\Downloads\AspectJInActionSecondEdition-sources-1.0.0\ch05\workspace\Section5.1.5ExampleVersion2\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @
section5.1.5ExampleVersion2 ---
[WARNING] File encoding has not been set, using platform encoding
Cp1252, i.e. build is platform dependent!
[INFO] Compiling 3 source files to
D:\Downloads\AspectJInActionSecondEdition-sources-1.0.0\ch05\workspace\Section5.1.5ExampleVersion2\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] \Downloads\AspectJInActionSecondEdition-sources-1.0.0\ch05\workspace\Section5.1.5ExampleVersion2\src\main\java\ajia\Identifiable.java:[23,20]
= expected
[ERROR] \Downloads\AspectJInActionSecondEdition-sources-1.0.0\ch05\workspace\Section5.1.5ExampleVersion2\src\main\java\ajia\Identifiable.java:[24,29]
= expected
[ERROR] \Downloads\AspectJInActionSecondEdition-sources-1.0.0\ch05\workspace\Section5.1.5ExampleVersion2\src\main\java\ajia\Identifiable.java:[24,32]
<identifier> expected
[ERROR] \Downloads\AspectJInActionSecondEdition-sources-1.0.0\ch05\workspace\Section5.1.5ExampleVersion2\src\main\java\ajia\Identifiable.java:[24,33]
';' expected
[ERROR] \Downloads\AspectJInActionSecondEdition-sources-1.0.0\ch05\workspace\Section5.1.5ExampleVersion2\src\main\java\ajia\Identifiable.java:[26,26]
'(' expected
[ERROR] \Downloads\AspectJInActionSecondEdition-sources-1.0.0\ch05\workspace\Section5.1.5ExampleVersion2\src\main\java\ajia\Identifiable.java:[26,32]
<identifier> expected
[ERROR] \Downloads\AspectJInActionSecondEdition-sources-1.0.0\ch05\workspace\Section5.1.5ExampleVersion2\src\main\java\ajia\Identifiable.java:[29,28]
= expected
[ERROR] \Downloads\AspectJInActionSecondEdition-sources-1.0.0\ch05\workspace\Section5.1.5ExampleVersion2\src\main\java\ajia\Identifiable.java:[29,34]
<identifier> expected
[ERROR] \Downloads\AspectJInActionSecondEdition-sources-1.0.0\ch05\workspace\Section5.1.5ExampleVersion2\src\main\java\ajia\Identifiable.java:[33,0]
class, interface, or enum expected
[ERROR] \Downloads\AspectJInActionSecondEdition-sources-1.0.0\ch05\workspace\Section5.1.5ExampleVersion2\src\main\java\ajia\Nameable.java:[23,20]
= expected
[ERROR] \Downloads\AspectJInActionSecondEdition-sources-1.0.0\ch05\workspace\Section5.1.5ExampleVersion2\src\main\java\ajia\Nameable.java:[24,24]
= expected
[ERROR] \Downloads\AspectJInActionSecondEdition-sources-1.0.0\ch05\workspace\Section5.1.5ExampleVersion2\src\main\java\ajia\Nameable.java:[24,29]
<identifier> expected
[ERROR] \Downloads\AspectJInActionSecondEdition-sources-1.0.0\ch05\workspace\Section5.1.5ExampleVersion2\src\main\java\ajia\Nameable.java:[24,30]
';' expected
[ERROR] \Downloads\AspectJInActionSecondEdition-sources-1.0.0\ch05\workspace\Section5.1.5ExampleVersion2\src\main\java\ajia\Nameable.java:[25,22]
'(' expected
[ERROR] \Downloads\AspectJInActionSecondEdition-sources-1.0.0\ch05\workspace\Section5.1.5ExampleVersion2\src\main\java\ajia\Nameable.java:[25,30]
<identifier> expected
[ERROR] \Downloads\AspectJInActionSecondEdition-sources-1.0.0\ch05\workspace\Section5.1.5ExampleVersion2\src\main\java\ajia\Nameable.java:[28,24]
= expected
[ERROR] \Downloads\AspectJInActionSecondEdition-sources-1.0.0\ch05\workspace\Section5.1.5ExampleVersion2\src\main\java\ajia\Nameable.java:[28,32]
<identifier> expected
[ERROR] \Downloads\AspectJInActionSecondEdition-sources-1.0.0\ch05\workspace\Section5.1.5ExampleVersion2\src\main\java\ajia\Nameable.java:[32,0]
class, interface, or enum expected
[INFO] 18 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.660s
[INFO] Finished at: Tue Dec 20 16:38:46 CET 2011
[INFO] Final Memory: 6M/120M
[INFO] ------------------------------------------------------------------------
[WARNING] The requested profile "private" could not be activated
because it does not exist.
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile
(default-compile) on project section5.1.5ExampleVersion2: Compilation
failure: Compilation failure:
[ERROR] \Downloads\AspectJInActionSecondEdition-sources-1.0.0\ch05\workspace\Section5.1.5ExampleVersion2\src\main\java\ajia\Identifiable.java:[23,20]
= expected
[ERROR] \Downloads\AspectJInActionSecondEdition-sources-1.0.0\ch05\workspace\Section5.1.5ExampleVersion2\src\main\java\ajia\Identifiable.java:[24,29]
= expected
[ERROR] \Downloads\AspectJInActionSecondEdition-sources-1.0.0\ch05\workspace\Section5.1.5ExampleVersion2\src\main\java\ajia\Identifiable.java:[24,32]
<identifier> expected
[ERROR] \Downloads\AspectJInActionSecondEdition-sources-1.0.0\ch05\workspace\Section5.1.5ExampleVersion2\src\main\java\ajia\Identifiable.java:[24,33]
';' expected
[ERROR] \Downloads\AspectJInActionSecondEdition-sources-1.0.0\ch05\workspace\Section5.1.5ExampleVersion2\src\main\java\ajia\Identifiable.java:[26,26]
'(' expected
[ERROR] \Downloads\AspectJInActionSecondEdition-sources-1.0.0\ch05\workspace\Section5.1.5ExampleVersion2\src\main\java\ajia\Identifiable.java:[26,32]
<identifier> expected
[ERROR] \Downloads\AspectJInActionSecondEdition-sources-1.0.0\ch05\workspace\Section5.1.5ExampleVersion2\src\main\java\ajia\Identifiable.java:[29,28]
= expected
[ERROR] \Downloads\AspectJInActionSecondEdition-sources-1.0.0\ch05\workspace\Section5.1.5ExampleVersion2\src\main\java\ajia\Identifiable.java:[29,34]
<identifier> expected
[ERROR] \Downloads\AspectJInActionSecondEdition-sources-1.0.0\ch05\workspace\Section5.1.5ExampleVersion2\src\main\java\ajia\Identifiable.java:[33,0]
class, interface, or enum expected
[ERROR] \Downloads\AspectJInActionSecondEdition-sources-1.0.0\ch05\workspace\Section5.1.5ExampleVersion2\src\main\java\ajia\Nameable.java:[23,20]
= expected
[ERROR] \Downloads\AspectJInActionSecondEdition-sources-1.0.0\ch05\workspace\Section5.1.5ExampleVersion2\src\main\java\ajia\Nameable.java:[24,24]
= expected
[ERROR] \Downloads\AspectJInActionSecondEdition-sources-1.0.0\ch05\workspace\Section5.1.5ExampleVersion2\src\main\java\ajia\Nameable.java:[24,29]
<identifier> expected
[ERROR] \Downloads\AspectJInActionSecondEdition-sources-1.0.0\ch05\workspace\Section5.1.5ExampleVersion2\src\main\java\ajia\Nameable.java:[24,30]
';' expected
[ERROR] \Downloads\AspectJInActionSecondEdition-sources-1.0.0\ch05\workspace\Section5.1.5ExampleVersion2\src\main\java\ajia\Nameable.java:[25,22]
'(' expected
[ERROR] \Downloads\AspectJInActionSecondEdition-sources-1.0.0\ch05\workspace\Section5.1.5ExampleVersion2\src\main\java\ajia\Nameable.java:[25,30]
<identifier> expected
[ERROR] \Downloads\AspectJInActionSecondEdition-sources-1.0.0\ch05\workspace\Section5.1.5ExampleVersion2\src\main\java\ajia\Nameable.java:[28,24]
= expected
[ERROR] \Downloads\AspectJInActionSecondEdition-sources-1.0.0\ch05\workspace\Section5.1.5ExampleVersion2\src\main\java\ajia\Nameable.java:[28,32]
<identifier> expected
[ERROR] \Downloads\AspectJInActionSecondEdition-sources-1.0.0\ch05\workspace\Section5.1.5ExampleVersion2\src\main\java\ajia\Nameable.java:[32,0]
class, interface, or enum expected
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with
the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions,
please read the following articles:
[ERROR] [Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

8<--------------------------------------------------------------------------------------------------------

It seems as if the aspectj-maven-plugin is not executed, although it
is configured in the parent project. I also tried to put the following
plugin configuration in the project's pom itself, with the same
result:

	<build>
		<plugins>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>aspectj-maven-plugin</artifactId>
				<executions>
					<execution>
						<goals>
							<goal>compile</goal>
							<goal>test-compile</goal>
						</goals>

						<configuration>
							<source>1.5</source>
							<target>1.5</target>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>


I'm using maven 3.0.3. Any ideas?


Best regards,
James


Back to the top