Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »

Welcome to Software Development on Codidact!

Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.

Review Suggested Edit

You can't approve or reject suggested edits because you haven't yet earned the Edit Posts ability.

Approved.
This suggested edit was approved and applied to the post 6 months ago by Alexei‭.

29 / 255
Maven JPA integration: processor not found
  • Personal Project:
  • I am new to Maven and have spent a few weeks troubleshooting pom errors with chatGPT. Tutorials are hard to come by online, because annotation-processing in Java is more complicated than the sources I've found. Issue in summary: my annotation processor "cannot be found" but everything \~looks okay. I need help spotting the issue in my Pom; Thank you in advance!
  • Background: In Eclipse IDE, I created a new Maven project with the quickstart-architype resulting in a project with this structure:
  • `Project:`
  • <br>`____pom.xml`
  • <br>`____src / main / java:`
  • <br>`________com.folder.Project:`
  • <br>`____________App.java`
  • <i><b>There isn't a META-INF directory in the Project hierarchy;</b> it does not get generated when I create Maven projects, but it should not be the issue.</i>
  • I also some files/ directories to com.folder.Project, resulting in:
  • `com.folder.Project:`
  • <br>`____App.java`
  • <br>`____archive:`
  • <br>`________Annotation.java`
  • <br>`____processors:`
  • <br>`________AnnotationProcessor.java`
  • <i>This is a new project, and there are not any added files outside of what I have mentioned. These added files even have the same name in my setup; I've set it up like this, purely to troubleshoot + learn how to create annotation processors in java.</i>
  • <b>Issue:
  • In the terminal, when I run "mvn compile -X" or other similar commands, I get an Error:
  • diagnostic: error: Annotation processor 'com.folder.Project.processors.AnnotationProcessor' not found.</b>
  • pom.xml:
  • ```<groupid>com.folder</groupid>
  • <artifactid>Project</artifactid>
  • <version>2024</version>
  • <packaging>jar</packaging>
  • <name>Project</name>
  • <url>http://maven.apache.org</url>
  • <dependencies>
  • <dependency>
  • <groupid>junit</groupid>
  • <artifactid>junit</artifactid>
  • <version>3.8.1</version>
  • <scope>test
  • </dependency>
  • <dependency>
  • <groupid>org.bsc.maven</groupid>
  • <artifactid>maven-processor-compiler</artifactid>
  • <version>5.0-jdk8</version>
  • </dependency>
  • <dependency>
  • <groupid>org.bsc.maven</groupid>
  • <artifactid>maven-processor-plugin</artifactid>
  • <version>5.0-jdk8-rc3</version>
  • </dependency>
  • </dependencies>
  • <build>
  • <plugins>
  • <plugin>
  • <groupid>org.apache.maven.plugins</groupid>
  • <artifactid>maven-compiler-plugin</artifactid>
  • <version>3.11.0</version>
  • </plugin>
  • <plugin>
  • <groupid>org.bsc.maven</groupid>
  • <artifactid>maven-processor-plugin</artifactid>
  • <version>5.0-jdk8-rc3</version>
  • <executions>
  • <execution>
  • <id>process</id>
  • <goals>
  • <goal>process
  • </goals>
  • <phase>generate-sources</phase>
  • <configuration>
  • <processors>
  • <processor>com.open.Engine.processors.AnnotationProcessor</processor>
  • </processors>
  • </configuration>
  • </execution>
  • </executions>
  • </plugin>
  • </plugins>
  • </build>
  • ```
  • The mistake is probably in my pom.
  • <br><i>I had to retype <tag>'s and </tag>'s, so ignore spelling errors related to those; in the XML view on Eclipse, each tag gives a meaningful description (versus, if a tag was spelled incorrectly or misplaced, it might not).</i>
  • Here are the simple classes I made for testing:
  • Annotation.java:
  • ```package com.folder.Project.archive;
  • // import from java.lang.annotation.Documented;
  • @Documented
  • public @interface Annotation { /*does nothing*/ }
  • ```
  • AnnotationProcessor.java:
  • ```package com.folder.Project.processors;
  • // imports from javax, and java.util.Set;
  • @SupportedAnnotationTypes( "com.folder.Project.archive.Annotation" ) // I'm not sure if this matches
  • public class AnnotationProcessor extends AbstractProcessor {
  • @Override public boolean process ( ... ) // Set and RoundElement inputs
  • {
  • processingEnv.getMessager().printMessage( Diagnostic.Kind.ERROR, "Error" );
  • return false; // so it should fail every time (which lets me know if it works)
  • }
  • }
  • ```
  • App.java:
  • ```import com.folder.Project.archive.Annotation;
  • ... main( String[] args ) {
  • @Annotation int x = 1;
  • System.out.println( "finished main" );
  • }
  • ```
  • The code is written so I can verify an annotation processor is executed at all.
  • --------
  • A few notes:
  • <i>
  • * diagnostic: error: Annotation processor 'com.folder.Project.processors.AnnotationProcessor' not found; is the 1st error to appear after running mvn compile.
  • * "mvn clean compile -X" doesn't elaborate on the error: Build Fail / could Not Execute / could not achieve goal.
  • * I run "Build Project", "Build All", and "Run" after every significant change to pom.xml.
  • * \<annotationprocessingpaths\>, from an alternative solution, was not a recognized tag in my pom dependency hierarchy (alternative solutions failed too).
  • * I have confirmed the spelling is correct in the files, with the correct filenames as well. If you see any spelling errors above, it's probably because I mistyped them into the question-forum text editor.</i>
  • ------
  • I'm trying to build annotation processors in Java; I think it has potential for lots of future projects. I understand it's a little niche, but also think it is probably important to know / be able to use effectively.
  • What steps should I take to get everything running normally, for annotation processing? What errors have I made?
  • <b>Thank you for your time</b>
  • - Tyler Bakeman
  • My annotation processor "cannot be found" but everything \~looks okay.
  • In Eclipse IDE, I created a new Maven project with the "quickstart-architype" resulting in a project with this structure:
  • ```
  • ____pom.xml
  • ____src/main/java
  • ________com.folder.Project
  • ____________App.java
  • ```
  • __There isn't a `META-INF` directory in the Project hierarchy;__ _it does not get generated when I create Maven projects, but it should not be the issue._
  • I also added some files/directories to com.folder.Project, resulting in:
  • ```
  • com.folder.Project
  • ____App.java
  • ____archive
  • ________Annotation.java
  • ____processors
  • ________AnnotationProcessor.java
  • ```
  • _This is a new project, and there are not any added files outside of what I have mentioned. These added files even have the same name in my setup; I've set it up like this, purely to troubleshoot and learn how to create annotation processors in Java._
  • In the terminal, when I run `mvn compile -X` or other similar commands, I get an error:
  • > diagnostic: error: Annotation processor 'com.folder.Project.processors.AnnotationProcessor' not found.
  • pom.xml:
  • ```
  • <groupid>com.folder</groupid>
  • <artifactid>Project</artifactid>
  • <version>2024</version>
  • <packaging>jar</packaging>
  • <name>Project</name>
  • <url>http://maven.apache.org</url>
  • <dependencies>
  • <dependency>
  • <groupid>junit</groupid>
  • <artifactid>junit</artifactid>
  • <version>3.8.1</version>
  • <scope>test
  • </dependency>
  • <dependency>
  • <groupid>org.bsc.maven</groupid>
  • <artifactid>maven-processor-compiler</artifactid>
  • <version>5.0-jdk8</version>
  • </dependency>
  • <dependency>
  • <groupid>org.bsc.maven</groupid>
  • <artifactid>maven-processor-plugin</artifactid>
  • <version>5.0-jdk8-rc3</version>
  • </dependency>
  • </dependencies>
  • <build>
  • <plugins>
  • <plugin>
  • <groupid>org.apache.maven.plugins</groupid>
  • <artifactid>maven-compiler-plugin</artifactid>
  • <version>3.11.0</version>
  • </plugin>
  • <plugin>
  • <groupid>org.bsc.maven</groupid>
  • <artifactid>maven-processor-plugin</artifactid>
  • <version>5.0-jdk8-rc3</version>
  • <executions>
  • <execution>
  • <id>process</id>
  • <goals>
  • <goal>process
  • </goals>
  • <phase>generate-sources</phase>
  • <configuration>
  • <processors>
  • <processor>com.open.Engine.processors.AnnotationProcessor</processor>
  • </processors>
  • </configuration>
  • </execution>
  • </executions>
  • </plugin>
  • </plugins>
  • </build>
  • ```
  • The mistake is probably in my POM file.
  • In the XML view in Eclipse, each tag gives a meaningful description (if a tag was spelled incorrectly or misplaced, it might not).
  • Here are the simple classes I made for testing:
  • Annotation.java:
  • ```java
  • package com.folder.Project.archive;
  • // import from java.lang.annotation.Documented;
  • @Documented
  • public @interface Annotation { /*does nothing*/ }
  • ```
  • AnnotationProcessor.java:
  • ```java
  • package com.folder.Project.processors;
  • // imports from javax, and java.util.Set;
  • @SupportedAnnotationTypes("com.folder.Project.archive.Annotation") // I'm not sure if this matches
  • public class AnnotationProcessor extends AbstractProcessor {
  • @Override public boolean process( ... ) // Set and RoundElement inputs
  • {
  • processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, "Error");
  • return false; // so it should fail every time (which lets me know if it works)
  • }
  • }
  • ```
  • App.java:
  • ```java
  • import com.folder.Project.archive.Annotation;
  • ... main(String[] args) {
  • @Annotation int x = 1;
  • System.out.println("finished main");
  • }
  • ```
  • The code is written so I can verify that an annotation processor is executed at all.
  • --------
  • A few notes:
  • - diagnostic: error: Annotation processor 'com.folder.Project.processors.AnnotationProcessor' not found; is the 1st error to appear after running mvn compile.
  • - `mvn clean compile -X` doesn't elaborate on the error: Build Fail / could Not Execute / could not achieve goal.
  • - I run "Build Project", "Build All", and "Run" after every significant change to pom.xml.
  • - \<annotationprocessingpaths\>, from an alternative solution, was not a recognized tag in my pom dependency hierarchy (alternative solutions failed too).
  • ------
  • What steps should I take to get everything running normally, for annotation processing? What errors have I made?