Tag Archives: maven

Bug: unable to download source code in idea, error cannot download sources sources not found for:XXX

Bug Description: idea can’t download the source code, click choose Resource & gt; [select source code package] to confirm and report an error.
Solution: enter the project in the command line interface pom.xml File folder, execute the following command:

mvn dependency:resolve -Dclassifier=sources

Note: do not directly execute the command in terminal in the lower left corner of idea, but in DOS interface.

Depending on the custom component jar package, unable to read meta data for class appears after startup


java.lang.IllegalStateException: Unable to read meta-data for class com.dyt.controller.TestController1
	at org.springframework.boot.autoconfigure.AutoConfigurationSorter$AutoConfigurationClass.getAnnotationMetadata(AutoConfigurationSorter.java:233) ~[spring-boot-autoconfigure-2.1.13.RELEASE.jar:2.1.13.RELEASE]
	at org.springframework.boot.autoconfigure.AutoConfigurationSorter$AutoConfigurationClass.getOrder(AutoConfigurationSorter.java:204) ~[spring-boot-autoconfigure-2.1.13.RELEASE.jar:2.1.13.RELEASE]
	at org.springframework.boot.autoconfigure.AutoConfigurationSorter$AutoConfigurationClass.access$000(AutoConfigurationSorter.java:150) ~[spring-boot-autoconfigure-2.1.13.RELEASE.jar:2.1.13.RELEASE]
	at org.springframework.boot.autoconfigure.AutoConfigurationSorter.lambda$getInPriorityOrder$0(AutoConfigurationSorter.java:62) ~[spring-boot-autoconfigure-2.1.13.RELEASE.jar:2.1.13.RELEASE]
	at java.util.TimSort.countRunAndMakeAscending(Unknown Source) ~[na:1.8.0_201]
	at java.util.TimSort.sort(Unknown Source) ~[na:1.8.0_201]
	at java.util.Arrays.sort(Unknown Source) ~[na:1.8.0_201]
	at java.util.ArrayList.sort(Unknown Source) ~[na:1.8.0_201]
	at org.springframework.boot.autoconfigure.AutoConfigurationSorter.getInPriorityOrder(AutoConfigurationSorter.java:61) ~[spring-boot-autoconfigure-2.1.13.RELEASE.jar:2.1.13.RELEASE]
	at org.springframework.boot.autoconfigure.AutoConfigurationImportSelector$AutoConfigurationGroup.sortAutoConfigurations(AutoConfigurationImportSelector.java:430) ~[spring-boot-autoconfigure-2.1.13.RELEASE.jar:2.1.13.RELEASE]
	at org.springframework.boot.autoconfigure.AutoConfigurationImportSelector$AutoConfigurationGroup.selectImports(AutoConfigurationImportSelector.java:415) ~[spring-boot-autoconfigure-2.1.13.RELEASE.jar:2.1.13.RELEASE]
	at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorGrouping.getImports(ConfigurationClassParser.java:872) ~[spring-context-5.1.14.RELEASE.jar:5.1.14.RELEASE]
	at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorGroupingHandler.processGroupImports(ConfigurationClassParser.java:798) ~[spring-context-5.1.14.RELEASE.jar:5.1.14.RELEASE]
	at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorHandler.process(ConfigurationClassParser.java:770) ~[spring-context-5.1.14.RELEASE.jar:5.1.14.RELEASE]
	at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:185) ~[spring-context-5.1.14.RELEASE.jar:5.1.14.RELEASE]
	at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:315) ~[spring-context-5.1.14.RELEASE.jar:5.1.14.RELEASE]
	at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:232) ~[spring-context-5.1.14.RELEASE.jar:5.1.14.RELEASE]
	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:275) ~[spring-context-5.1.14.RELEASE.jar:5.1.14.RELEASE]
	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:95) ~[spring-context-5.1.14.RELEASE.jar:5.1.14.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:705) ~[spring-context-5.1.14.RELEASE.jar:5.1.14.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:531) ~[spring-context-5.1.14.RELEASE.jar:5.1.14.RELEASE]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-2.1.13.RELEASE.jar:2.1.13.RELEASE]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:744) [spring-boot-2.1.13.RELEASE.jar:2.1.13.RELEASE]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:391) [spring-boot-2.1.13.RELEASE.jar:2.1.13.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) [spring-boot-2.1.13.RELEASE.jar:2.1.13.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) [spring-boot-2.1.13.RELEASE.jar:2.1.13.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1204) [spring-boot-2.1.13.RELEASE.jar:2.1.13.RELEASE]
	at com.dyt.MybatisApplication.main(MybatisApplication.java:12) [classes/:na]
Caused by: java.io.FileNotFoundException: class path resource [com/dyt/controller/TestController1.class] cannot be opened because it does not exist
	at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:180) ~[spring-core-5.1.14.RELEASE.jar:5.1.14.RELEASE]
	at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:51) ~[spring-core-5.1.14.RELEASE.jar:5.1.14.RELEASE]
	at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:103) ~[spring-core-5.1.14.RELEASE.jar:5.1.14.RELEASE]
	at org.springframework.boot.type.classreading.ConcurrentReferenceCachingMetadataReaderFactory.createMetadataReader(ConcurrentReferenceCachingMetadataReaderFactory.java:86) ~[spring-boot-2.1.13.RELEASE.jar:2.1.13.RELEASE]
	at org.springframework.boot.type.classreading.ConcurrentReferenceCachingMetadataReaderFactory.getMetadataReader(ConcurrentReferenceCachingMetadataReaderFactory.java:73) ~[spring-boot-2.1.13.RELEASE.jar:2.1.13.RELEASE]
	at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:81) ~[spring-core-5.1.14.RELEASE.jar:5.1.14.RELEASE]
	at org.springframework.boot.autoconfigure.AutoConfigurationSorter$AutoConfigurationClass.getAnnotationMetadata(AutoConfigurationSorter.java:229) ~[spring-boot-autoconfigure-2.1.13.RELEASE.jar:2.1.13.RELEASE]
	... 27 common frames omitted

/ meta-inf /spring.factories

br br br /classes




MVN error: @ param not found

The code is fine, it handles the comments (which is why I always advocate that you don’t write the comments). How to do?Add a parameter:
Option 1 (invalid) :

mvn \
    -Xdoclint:none

Complains.
Method 2 (effective) :
Search for maven-javadoc-plugin in pom.xml and change it to something like this:
After 3.0.0:


  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-javadoc-plugin</artifactId>
    <configuration>
      <doclint>none</doclint>
    </configuration>
  </plugin>

3.0.0 before:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-javadoc-plugin</artifactId>
    <configuration>
      <additionalparam>-Xdoclint:none</additionalparam>
    </configuration>
  </plugin>

 

Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:3.0.0:clean (default-clean) on

Failed to execute goal org, apache maven. Plugins: maven – clean – plugin: 3.0.0: clean (default – the clean) on project springboot1: Failed to clean project: Failed to delete the F: \ springboot1 \ target – & gt;
To see the full stack trace of the errors, re-run Maven with the -e switch.
The cause of this problem is that the CMD command window to start Springboot1 is open under the target file path of the project Springboot1. This causes the package Springboot1 project to fail. To see the full stack trace of the errors, re-run Maven with the -e switch. You need to shut down a Maven and reopen it.
Solution: Close the CMD command window that starts Springboot1. Just pack it up again.

Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:run (default-cli) on project

Complete error message

Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:run (default-cli) on project jurisdiction_controller: Could not start Tomcat


Start the Maven project wrong, use Tomcat embedded in it
The solution
The dependent use of servlets is introduced in the pom.xml file


Change after

add scope tags, and the values is provided (only role in the compilation and testing, and at the same time not pass)
The scope label specifies the range of values
compile
The default scope, which means that all Dependencies can be used throughout the lifecycle. Furthermore, these dependencies are passed to the projects on which they depend. Applies to all phases and will be released along with the project
provided
Similar to compile, but indicating that dependency is provided by JDKs or containers, such as Servlet APs and some Java EE APIs. This scope can only be used during compilation and testing and has no transitivity.
runtime
Dependency does not apply at compile time, but does apply at run and test times, such as JDBC drivers, for the run and test phases.
test
Indicates that dependency is applied at test time, not at run time. Used only during testing, to compile and run test code. Will not be released with the project.
system
Similar to Provided, but provided in the system as an external JAR, Maven does not look for it in a repository.

Application of IntelliJ idea in Maven project pom.xml Add dependency


You can quickly add dependencies by using the shortcut Alt + Insert key at the location where you want to add them
The first feature allows you to search directly for the module name and then add it


The Dependency Template helps us generate the corresponding tags directly in the XML

We need to complete the information ourselves

3. Idea creates a springboot project, and spring initializer reports an error Error:connect timed out

Error: Connect timed out when creating SpringBoot + Maven project today.

Check the problem of HTTP proxy of IDEA, the solution is as follows:
The first kind of
1. Open the file – Settings

2. Select Appearance& Behavior — System Settings — HTTP Proxy — Check Connection on the right — type https://start.spring.io

If it does, you can rewrite the build project.
If the connection fails and the following image is shown, you can try method two.

The second,
1. When creating a new project, select the source of Ali Cloud under Spring Initializr and enter https://start.aliyun.com under Custom
Create a new project with SpringBoot + Maven

2. Create successfully!

New Maven project– pom.xml report errors

Welcome to blog using the Markdown editor
Sometimes when we create new Maven projects, the pom.xml file likes to report errors (especially on the first line!). . However, our Settings configuration and so on are all fine. You may be confused at this point, but that’s okay. Follow these steps and give it a try. It might solve your problem.
The reason: Eclipse integrated Maven had issues (version issues or site access issues), and the newly installed Maven was not successfully added to the M2e plug-in
The solution is as follows:
Step.1 Go to the official website to download the appropriate version of Maven and store it in the appropriate path (or check the missing JAR file in the report — the corresponding error message will provide the URL to download the missing file — copy it to the appropriate path in the local repository).
Step.2 Open Eclipse Preferences -> Maven-> UserSettings changes the Global Settings and UserSettings to conf/settings.xml in Maven that you just downloaded
Step. 3 the Eclipse preferences – & gt; Maven-> * * * Click on Add to Add the Maven folder you just downloaded, and then check your own version instead of using the built-in one
Step.4 After the above two steps, you have successfully integrated the Maven version you downloaded with Eclipse, and then right-click on the project that reported an error before, and right-click Run As ->; Maven clean, then Run As ->; Maven install

ep.5: project right-click ->; Maven-> The Update Project step takes a bit of time and you can see if the Update has been completed by looking at the bottom right corner of the screen.

Failed to execute goal

To summarize, Maven packaging, a project engineering development tool called Idea14, uses JDK version 1.8
1. You need to close the idea before packaging, otherwise part of the files will not be deleted when MVN is clean, and files will also be lost when MVN is package.

2. MVN package packaging ERROR: [ERROR] Failed to execute goal. Org. Apache maven. Plugins: maven – clean – plugin: 2.6.1: clean (default – the clean) on the project
Solutions:
1. The POM configuration for the Maven plug-in is as follows:

<plugin>  
    <groupId>org.apache.maven.plugins</groupId>  
    <artifactId>maven-compiler-plugin</artifactId>  
    <version>3.1</version>  
    <configuration>  
        <verbose>true</verbose>  
        <fork>true</fork>  
        <executable>${JAVA_HOME}/bin/javac</executable>  
    </configuration>  
</plugin>  

${JAVA8_HOME} (${JAVA8_HOME}, ${JAVA8_HOME})

The ${JAVA8_HOME} variable is configured in settings.xml as follows:

<profile>  
            <id>custom-compiler</id>  
            <properties>  
                <JAVA8_HOME>C:\Program Files (x86)\Java\jdk1.8.0_73</JAVA8_HOME>  
            </properties>  
</profile>  

Of course this should be enabled, so the settings.xml file should also have the following configuration:

<activeProfiles>  
        <activeProfile>custom-compiler</activeProfile>  
</activeProfiles>  

Maven has a default repository. M2 repository and a default settings.xml configuration file. This default settings.xml file also adds a JAVA_HOME variable, and the compile is completed. If you are using the MVN package command in the CMD window, you are not using the settings.xml in idea. You are using the settings.xml in E: Tools\ maven \conf. You are using the Settings in E: Tools\ maven \conf. Because there is no default configuration to compile using the 1.8 version of the JDK, the JAVA_HOME could not be found before, resulting in a compilation failure.

Import Maven project pom.xml File error

Importing Maven project POM file error:

Execution default-resources of goal org.apache.maven.plugins:maven-resources-plugin:2.5:resources failed: Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved: Failure to transfer commons-cli:commons-cli:jar:1.0 from http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact commons-cli:commons-cli:jar:1.0 from/to central (http://repo.maven.apache.org/maven2): connection timed out to http://repo.maven.apache.org/maven2/commons-cli/commons-cli/1.0/commons-cli-1.0.jar (org.apache.maven.plugins:maven-resources-plugin:2.5:resources:default-resources:process-resources)


code> c>userprofile %\.m2\repository
for/r> in (*. LastUpdated) do del % I
and>ect maven-> Update the project.