maven compilation failure

前端 未结 18 2181
不知归路
不知归路 2020-12-07 17:57

I have a weird problem - Some class file couldn\'t be read during maven build.

  1. I have a project A and project B.
  2. Project
相关标签:
18条回答
  • 2020-12-07 18:30

    It COULD be due to insufficient heap memory.

    It sounds strange, but try it, it might just work:

    export MAVEN_OPTS='-Xms384M -Xmx512M -XX:MaxPermSize=256M'
    

    Source: https://groups.google.com/group/neo4j/msg/e208be9ee1c101d7)

    0 讨论(0)
  • 2020-12-07 18:30

    Just now I also met the problem

    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project entry-api: Compilation failure: Compilation failure:
    
    package com.foo.entry.common.domain does not exist
    package com.foo.entry.common.model does not exist
    package com.foo.entry.common.service does not exist
    package com.foo.entry.common.util does not exist
    

    Took a long time got the reason, that is one of the dependency jar is spring boot fat jar, so the solution is move below code in its pom.xml

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
    
    0 讨论(0)
  • 2020-12-07 18:33

    i have an error like this, but after

    1/

     mvn eclipse:clean
        mvn eclipse:eclipse -Dwtpversion=2.0
    

    2/ run eclipse, and open the project

    3/

    mvn package
    

    it's work

    0 讨论(0)
  • 2020-12-07 18:33

    If your dependencies are fine (check with mvn dependency:list) like mine were, then it's a maven glitch, if you're using Eclipse do:

    1. Right click the project > Maven > Update Project...
    2. Check everything but Offline
    3. OK

    You should be good.

    I don't know the equivalent mvn commands, if anyone could post them they could be useful.

    0 讨论(0)
  • 2020-12-07 18:33

    Add <sourceDirectory>src</sourceDirectory> in your pom.xml with proper reference. Adding this solved my problem

    0 讨论(0)
  • 2020-12-07 18:38

    Inside in yours classses on which is complain maven is some dependecy which belongs to some jar's try right these jars re-build with maven command, i use this command mvn clean install -DskipTests=true should be work in this case when some symbols from classes is missing

    0 讨论(0)
提交回复
热议问题