Tag Archives: maven

The import Maven project appears http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException Solutions

error occurs when importing maven project, conducting maven clean, and maven install:

[ERROR] Failed to execute goal. Org. Apache maven. Plugins: maven — the compiler plugin: 3.1: the compile (default – the compile) on project mvc2: Compilation failure
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[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

is running on a JRE rather than a JDK version.

is running on a JRE rather than a JDK version

  1. window – & gt; The preferences – & gt; Java – & gt; Installed JREs
  2. find JDK installation path

  3. select the JDK – & gt; apply
  4. maven clean again, maven install, if the problem remains, For the operation:



  5. open pom. The XML file, The following configuration under the plugins will source target to correspond to the JDK version (I was) 1.8:
<plugin>
 <groupId>org.apache.maven.plugins</groupId>
 <artifactId>maven-surefire-plugin</artifactId>
 <version>2.4.2</version>
 <configuration> 
 <source>1.8</source>
 <target>1.8</target>
 </configuration>
 </plugin>

set the JDK version 1.8
maven clean again, maven install, no error, can be loaded, But the project may still be small Red Cross on the top left corner, specific error is as follows:
Dynamic Web Module 3.0 requires Java 1.6 or newer.


specific solution is as follows:
find apache – maven installation path;

in Apache-maven-3.5.3 /conf/settings.xml file with the following configuration (depending on JDK version, mine is 1.8) :

<profiles>     
       <profile>       
            <id>jdk-1.8</id>       
            <activation>       
                <activeByDefault>true</activeByDefault>       
                <jdk>1.8</jdk>       
            </activation>       
            <properties>       
                <maven.compiler.source>1.8</maven.compiler.source>       
                <maven.compiler.target>1.8</maven.compiler.target>       
                <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>       
            </properties>       
    </profile>      
</profiles>   

re Maven > Update project can solve this problem.

this article reprinted in: https://blog.csdn.net/ZkD953/article/details/79935520

How to Fix “junit.framework.Comparison Failure Expected: but was”

junit.framework.ComparisonFailure: expected:< . > But was: solution

an error occurred while running the MVN instruction: MVN clean test using the DOS window:

[ERROR] Please refer to D:\ learning gadgets \ first semester of junior \ enterprise application construction and management \ experiments \maven_demo\target\surefire-reports for the individual test results

error display from the surefire – reports file to find errors, check the surefire – reports file:

error body is this:
junit.framework.ComparisonFailure: expected:< Hello [World]guoyilin! > but was:< Hello []guoyilin! >

in the test file called assetEquals method, the method to compare the the statement with a specified in parentheses, if different than the error


you can see, The statement returned in the sayHello method is different from the statement specified in the test module, and that’s where the error is, just change the statement to be the same.

Spring boot can’t scan XML (invalid bound statement (not found))

in a recent work on a project, a headache problem, the background and foreground, after a successful start in obtaining some mapper, always show can not find the mapper, but if use Ctrl or can enter this method, on the Internet to find a lot of solutions, did not solve my problem, the following are some of the common rule out way:

1, check whether namespace in your XML file is correct

2. Check whether the mapper method written by yourself is consistent or missing with the method in XML, and whether the return type or name is consistent

3. If it is not possible yet, take a look to see if the XML configuration path of mapper is correct

4. Delete some Spaces in XML

5, I encountered myself, to see if the target file exists and is a level 1 directory:

, if you’re like me, you can delete the new mapper, and when you create a new mapper, you can create a new mapper, and you can create a new directory on the mapper.

and finally the target should look like this:

is just like that.

if not solved, you can leave a message to communicate with oh ~