Tag Archives: maven

Error reporting when importing Maven project from MyEclipse

1. Right click the project and build path to see if there is a jar error. Remove useless jars and modify the corresponding JDK version

2. Check the SRC source file to see if there is an error in the source file. Found out, really

On the imported package, an error is reported: the import javax.servlet.annotation cannot be resolved  

Then report in problems: eclipse “cannot be resolved to a type” error

— solution:

Finally, in the process of trying, it is found that the version of Tomcat configured by JDK and eclipse does not match. The JDK version is 1.7   Tomcat is 1.6, so some packages don’t

Solution: build path – add library – MyEclipse server Library (some are server runtime, as long as it can be configured to the server, you can try it with the word server)

Then click. Then in

Click the Tomcat version you installed, and then click OK to finish. The mistake disappeared

 

How to Solve Maven Project Error: Cannot change version of project facet Dynamic web module to 3.0/3.1

How to Solve maven project: Cannot change version of project facet Dynamic web module to 3.0

1. Open the .settings folder in the project directory

open org.eclipse.wst.common.project.facet.core.xml

<installed facet=”java” version=”1.5″/> chane to <installed facet=”java” version=”1.8″/>,把 <installed facet=”jst.web” version=”2.3″/> chane to <installed facet=”jst.web” version=”3.0″/>

<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
  <fixed facet="wst.jsdt.web"/>
  <installed facet="java" version="1.8"/>
  <installed facet="jst.web" version="3.0"/>
  <installed facet="wst.jsdt.web" version="1.0"/>
</faceted-project>

2. Add in pom.xml

<!-- define the project compile level -->  
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>          
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>

Maven Error compiling the project: diamond operator is not supported in -source 1.5

< profile>

< id> jdk-1.7</ id>

< activation>

< activeByDefault> true</ activeByDefault>

< jdk> 1.7</ jdk>

</ activation>

< properties>

< maven.compiler.source> 1.7</ maven.compiler.source>

< maven.compiler.target> 1.7</ maven.compiler.target>

< maven.compiler.compilerVersion> 1.7</ maven.compiler.compilerVersion>

</ properties>

</ profile>

Remove dependency-reduced-pom.xml file when packaging Maven project

Explain the function of static keyword and final keyword in Java in detail>>>

The shade plug-in is generated during packaging and can be deleted at any time

If you do not want to generate it, the configuration is as follows:

<plugin>
   <groupId>org.apache.maven.plugins</groupId>
   <artifactId>maven-shade-plugin</artifactId>
   <configuration>
      <createDependencyReducedPom>false</createDependencyReducedPom>
   </configuration>
   <executions>
      <execution>
         <phase>package</phase>
         <goals>
            <goal>shade</goal>
         </goals>
         <configuration>
            <transformers>
               <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                  <mainClass>a.b.c.Main</mainClass>
               </transformer>
            </transformers>
         </configuration>
      </execution>
   </executions>
</plugin>

[Solved] Maven Error: No compiler is provided in this environment. Perhaps you are running on a JRE rather t…

No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

You should specify a JDK instead of a JRE. Show the JRE home, but the need is a complete JDK

Solution: Eclipse — > Window–> preferences–> Java–> Installed jres select the directory and find the location of JDK

If it has been configured, remove it and configure it again

Above has solved the compilation common project to report the wrong question

If you still have problems compiling with maven, you can reconfigure the Maven environment

Eclipse–> Window–> preferences–> Maven–> User Settings

Maven Package Error: [INFO] Using Groovy-Eclipse compiler to compile both Java and Groovy files

Maven Package Error: [INFO] Using Groovy-Eclipse compiler to compile both Java and Groovy files

Error:

[INFO] Using Groovy-Eclipse compiler to compile both Java and Groovy files java.lang.NullPointerException at java.util.zip.ZipFile.getZipEntry(ZipFile.java:566) at java.util.zip.ZipFile.access$900(ZipFile.java:60) at java.util.zip.ZipFile$ZipEntryIterator.next(ZipFile.java:524) at java.util.zip.ZipFile$ZipEntryIterator.nextElement(ZipFile.java:499) at java.util.zip.ZipFile$ZipEntryIterator.nextElement(ZipFile.java:480) at org.eclipse.jdt.internal.compiler.batch.ClasspathJar.isPackage(ClasspathJar.java:155) at org.eclipse.jdt.internal.compiler.batch.ClasspathJar.findClass(ClasspathJar.java:94) at org.eclipse.jdt.internal.compiler.batch.FileSystem.findClass(FileSystem.java:262) at org.eclipse.jdt.internal.compiler.batch.FileSystem.findType(FileSystem.java:354) at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createPackage(LookupEnvironment.java:765) at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.buildTypeBindings(CompilationUnitScope.java:132) at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.buildTypeBindings(LookupEnvironment.java:194) at org.eclipse.jdt.internal.compiler.Compiler.internalBeginToCompile(Compiler.java:780) at org.eclipse.jdt.internal.compiler.Compiler.beginToCompile(Compiler.java:395) at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:485) at org.eclipse.jdt.internal.compiler.batch.Main.performCompilation(Main.java:4157) at org.eclipse.jdt.internal.compiler.batch.Main.compile(Main.java:1694) at org.codehaus.groovy.eclipse.compiler.InternalCompiler.doCompile(InternalCompiler.java:84) at org.codehaus.groovy.eclipse.compiler.GroovyEclipseCompiler.internalCompile(GroovyEclipseCompiler.java:132) at org.codehaus.groovy.eclipse.compiler.GroovyEclipseCompiler.performCompile(GroovyEclipseCompiler.java:90) at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:825) at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:129) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288) at org.apache.maven.cli.MavenCli.main(MavenCli.java:199) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)

Error Environment

jdk 1.8 + maven 3.3.9

Solution:

Remove  <compilerId>groovy-eclipse-compiler</compilerId> in pom

[How to Solve Maven Error] invalid LOC header (bad signature)

Error log:

Warning: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/maven_pro]]
	at java.util.concurrent.FutureTask.report(Unknown Source)
	at java.util.concurrent.FutureTask.get(Unknown Source)
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:941)
	at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:872)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1421)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1411)
	at java.util.concurrent.FutureTask.run(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/maven_pro]]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
	... 6 more
Caused by: org.apache.catalina.LifecycleException: Failed to start component [org.apache.catalina.webresources.StandardRoot@65ffa54a]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
	at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4868)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5003)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	... 6 more
Caused by: org.apache.catalina.LifecycleException: Failed to initialize component [org.apache.catalina.webresources.JarResourceSet@eb36d16]
	at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:112)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:140)
	at org.apache.catalina.webresources.StandardRoot.startInternal(StandardRoot.java:724)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	... 9 more
Caused by: java.lang.IllegalArgumentException: java.util.zip.ZipException: invalid LOC header (bad signature)
	at org.apache.catalina.webresources.AbstractSingleArchiveResourceSet.initInternal(AbstractSingleArchiveResourceSet.java:142)
	at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107)
	... 12 more
Caused by: java.util.zip.ZipException: invalid LOC header (bad signature)
	at java.util.zip.ZipFile.read(Native Method)
	at java.util.zip.ZipFile.access$1400(Unknown Source)
	at java.util.zip.ZipFile$ZipFileInputStream.read(Unknown Source)
	at java.util.zip.ZipFile$ZipFileInflaterInputStream.fill(Unknown Source)
	at java.util.zip.InflaterInputStream.read(Unknown Source)
	at sun.misc.IOUtils.readFully(Unknown Source)
	at java.util.jar.JarFile.getBytes(Unknown Source)
	at java.util.jar.JarFile.getManifestFromReference(Unknown Source)
	at java.util.jar.JarFile.getManifest(Unknown Source)
	at org.apache.catalina.webresources.AbstractSingleArchiveResourceSet.initInternal(AbstractSingleArchiveResourceSet.java:140)
	... 13 more

Use the maven test command to detect.

The following error was found

[WARNING] Error reading d:\repository\com\fasterxml\woodstox\woodstox-core\5.0.3\woodstox-core-5.0.3.jar; invalid LOC header (bad signature)

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building maven_pro Maven Webapp 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for com.powersi:powerbase:jar:1.0.0 is missing, no dependency information available
[WARNING] The POM for com.powersi:powermarker:jar:1.0.0 is missing, no dependency information available
[WARNING] The POM for oracle.jdbc:OracleDriver:jar:12.1.0.2 is missing, no dependency information available
[WARNING] The POM for org.apache.dubbo:dubbo-all:jar:2.7.0 is missing, no dependency information available
[WARNING] The POM for commons-beanutils:commons-beanutils:jar:1.8.0 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for com.yinhai:bcp-dubbocs:jar:1.0.0 is missing, no dependency information available
[WARNING] The POM for com.powersi.biz:commonbiz:jar:1.0 is missing, no dependency information available
[WARNING] The POM for com.powersi.biz:sicp3_enc:jar:1.0 is missing, no dependency information available
[WARNING] The POM for com.powersi.biz:PowerFile_fat:jar:1.0 is missing, no dependency information available
[WARNING] The POM for com.powersi.biz:pd_analysis:jar:1.0 is missing, no dependency information available
[WARNING] The POM for commons-net:commons-net:jar:2.0 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for org.apache.struts:struts:jar:1.0 is missing, no dependency information available
[WARNING] The POM for org.aspectj.weaver:aspectjweaver:jar:1.9.1 is missing, no dependency information available
[WARNING] The POM for com.aspose.words:asposewords:jar:jdk16:14.11.0.0 is missing, no dependency information available
[WARNING] The artifact javax.xml:jaxb-api:pom:2.1 has been relocated to javax.xml.bind:jaxb-api:pom:2.1
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ maven_pro ---
[INFO] Using 'GBK' encoding to copy filtered resources.
[INFO] Copying 49 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ maven_pro ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 489 source files to E:\powersi\code\maven_pro\target\classes
[WARNING] Read d:\repository\com\fasterxml\woodstox\woodstox-core\5.0.3\woodstox-core-5.0.3.Error on jar; invalid LOC header (bad signature)
[WARNING] /E:/powersi/code/maven_pro/src/main/java/com/powersi/conf/common/action/DataImportAction.java: Some input files use or override outdated APIs.
[WARNING] /E:/powersi/code/maven_pro/src/main/java/com/powersi/conf/common/action/DataImportAction.java: For more information, please use -Xlint: deprecation to recompile.
[WARNING] /E:/powersi/code/maven_pro/src/main/java/com/powersi/conf/problem/action/ProManagerAction.java: Some input files use unchecked or unsafe actions.
[WARNING] /E:/powersi/code/maven_pro/src/main/java/com/powersi/conf/problem/action/ProManagerAction.java: For more information, please use -Xlint: unchecked to recompile.
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ maven_pro ---
[INFO] Using 'GBK' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ maven_pro ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ maven_pro ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.721 s
[INFO] Finished at: 2019-09-11T15:45:19+08:00
[INFO] Final Memory: 42M/581M
[INFO] ------------------------------------------------------------------------

Delete the woodstox core folder in the local Maven warehouse and install Maven clean again

[Solved] Maven error: invalid CEN header (bad signature)

1. Find problems
right click pom.xml, run as – > After Maven install, you will see some similar messages in the console, such as errors in Maven repository, repos, org, mortbay, jetty, servlet-api-2.5, 6.1h.14.1, servlet-api-2.5, 6.1h.14.1, jar and so on. Pom.xml displays a red cross

2. Cause analysis
the package was not downloaded correctly

3. Solution
find the directory of the package, delete the package and download it again. After downloading again, test it with Maven test, and the Red Cross disappears

When eclipse uses Maven: index downloads are disabled, search results may be incomplete

Why can’t you stop buying 618?From the technical dimension to explore>>>

when eclipse uses Maven: index downloads are disabled, search results may be incomplete

Reference article:

(1) When eclipse uses Maven: index downloads are disabled, search results may be incomplete

(2) https://www.cnblogs.com/EasonJim/p/6674099.html

Let’s make a note.

[Solved] Jsonobject has no from object, idea has no Maven dependency, jsonobject Maven dependency package

Contents:

1. Jsonobject Maven dependency package

2. Idea introduced Maven has a red line, no dependence

3. Jsonobject has no fromobject

\\\\\\\\\\\\\\\\\\\\\\\

1. Jsonobject Maven dependency package

A total of one, but the full function of six, I also found the Internet

Pom.xml is as follows:

<dependencies>

  <!-- https://mvnrepository.com/artifact/net.sf.json-lib/json-lib -->
  <dependency>
    <groupId>net.sf.json-lib</groupId>
    <artifactId>json-lib</artifactId>
    <version>2.4</version>
    <classifier>jdk15</classifier>
  </dependency>

  <dependency>
    <groupId>org.json</groupId>
    <artifactId>json</artifactId>
    <version>20160810</version>
  </dependency>
  <!-- https://mvnrepository.com/artifact/net.sf.ezmorph/ezmorph -->
  <dependency>
    <groupId>net.sf.ezmorph</groupId>
    <artifactId>ezmorph</artifactId>
    <version>1.0.6</version>
  </dependency>


  <!-- https://mvnrepository.com/artifact/commons-beanutils/commons-beanutils -->
  <dependency>
    <groupId>commons-beanutils</groupId>
    <artifactId>commons-beanutils</artifactId>
    <version>1.9.3</version>
  </dependency>

  <!-- https://mvnrepository.com/artifact/commons-collections/commons-collections -->
  <dependency>
    <groupId>commons-collections</groupId>
    <artifactId>commons-collections</artifactId>
    <version>3.2.2</version>
  </dependency>


  <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
  <dependency>
    <groupId>org.apache.commons</groupId>
    <artifactId>commons-lang3</artifactId>
    <version>3.4</version>
  </dependency>

  <!-- https://mvnrepository.com/artifact/commons-lang/commons-lang -->
  <dependency>
    <groupId>commons-lang</groupId>
    <artifactId>commons-lang</artifactId>
    <version>2.6</version>
  </dependency>

  <!-- https://mvnrepository.com/artifact/commons-logging/commons-logging -->
  <dependency>
    <groupId>commons-logging</groupId>
    <artifactId>commons-logging</artifactId>
    <version>1.2</version>
  </dependency>


  <dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>3.8.1</version>
    <scope>test</scope>
  </dependency>

  <dependency>
    <groupId>commons-io</groupId>
    <artifactId>commons-io</artifactId>
    <version>2.4</version>
  </dependency>

</dependencies>

2. idea introduces maven with red lines and no dependencies.
For a number of reasons.
may be the wrong path.
or the repository is not downloaded at all.
Some are computer cards, not buffered on, you can click on the following chart.

Another is: the following red box is missing. It means jars used in different environments or jdks under the same version. If this element is configured, the element name will be added at the end to find the corresponding jar

The path is all right, but you have to decide the jar again

3. Jsonobject has no fromobject

This is a fuckin ‘thing

You may have used this bag

But fromobject is in the following package