java - Error mvn clean install "You need to run build with JDK or have tools.jar on the classpath.If...l" - St

I have linked a JDK 1.8 which has tools.jar. I am using Eclipse, the project is compiled with Java 1.8

I have linked a JDK 1.8 which has tools.jar. I am using Eclipse, the project is compiled with Java 1.8 and Maven 3.3.9, but I am getting the following error:

.apache.maven.plugin.MojoExecutionException: You need to run the build with JDK or have tools.jar on the classpath.If this occurs during eclipse build, make sure you run Eclipse under JDK as well

I have the Java and Maven environment variables set up. It is set up in Preference > Java > Installed JREs with the JDK 1.8 installation.

The pom.xml where the error is occurring has the following build:

<build>
    <plugins>
        <plugin>
            <groupId>com.mysema.maven</groupId>
            <artifactId>apt-maven-plugin</artifactId>
            <version>1.1.3</version>
            <executions>
                <execution>
                    <goals>
                        <goal>process</goal>
                    </goals>
                    <configuration>
                        <outputDirectory>target/generated-sources/java</outputDirectory>
                        <processor>com.querydsl.apt.jpa.JPAAnnotationProcessor</processor>
                    </configuration>
                </execution>
            </executions>
            <dependencies>
                <dependency>
                    <groupId>com.querydsl</groupId>
                    <artifactId>querydsl-apt</artifactId>
                    <version>${querydsl.version}</version>
                </dependency>
            </dependencies>
        </plugin>
    </plugins>
</build>

I have this option checked in Maven > Java Configurator

If there is any further information that I need to provide or check, please let me know.

Add tools.jar to reference the library

I have linked a JDK 1.8 which has tools.jar. I am using Eclipse, the project is compiled with Java 1.8 and Maven 3.3.9, but I am getting the following error:

.apache.maven.plugin.MojoExecutionException: You need to run the build with JDK or have tools.jar on the classpath.If this occurs during eclipse build, make sure you run Eclipse under JDK as well

I have the Java and Maven environment variables set up. It is set up in Preference > Java > Installed JREs with the JDK 1.8 installation.

The pom.xml where the error is occurring has the following build:

<build>
    <plugins>
        <plugin>
            <groupId>com.mysema.maven</groupId>
            <artifactId>apt-maven-plugin</artifactId>
            <version>1.1.3</version>
            <executions>
                <execution>
                    <goals>
                        <goal>process</goal>
                    </goals>
                    <configuration>
                        <outputDirectory>target/generated-sources/java</outputDirectory>
                        <processor>com.querydsl.apt.jpa.JPAAnnotationProcessor</processor>
                    </configuration>
                </execution>
            </executions>
            <dependencies>
                <dependency>
                    <groupId>com.querydsl</groupId>
                    <artifactId>querydsl-apt</artifactId>
                    <version>${querydsl.version}</version>
                </dependency>
            </dependencies>
        </plugin>
    </plugins>
</build>

I have this option checked in Maven > Java Configurator

If there is any further information that I need to provide or check, please let me know.

Add tools.jar to reference the library

Share Improve this question edited Mar 21 at 9:09 Maksim Banit 1853 bronze badges asked Mar 21 at 8:13 Alejandro Manuel CarrionAlejandro Manuel Carrion 13 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Maven uses the JDK/JRE that it finds at JAVA_HOME not via the Eclipse >> Installed JREs.

You need to set the JAVA_HOME environment variable to a JDK not a JRE eg

JAVA_HOME=C:\Program Files\Java\jdk-17

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744366712a4570739.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信