在日食氧气上从bitbucket导入项目是不正确的(使用src.main作为包名称的一部分)

时间:2017-09-26 16:22:04

标签: eclipse maven bitbucket pom.xml jhipster

我试图从bitbucket结账JHipster项目,虽然我可以在我的办公室电脑(A)上这样做,但我无法在家用电脑上获得相同的结果(B)。

我使用的IDE都是eclipse-oxygen,我在Java Perspective上。您将从图片B中注意到导入(在A上以相同的方式执行)将src.main.java视为包的一部分,因此编译器指示包名称不正确的错误。

而A有src/main/java

B有src.main.java.com...

如何修复B?

enter image description here

enter image description here

pom.xml的快照(堆栈溢出限制为30K字符)

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <artifactId>spring-boot-starter-parent</artifactId>
        <groupId>org.springframework.boot</groupId>
        <version>1.5.7.RELEASE</version>
        <relativePath/>
    </parent>

    <groupId>com.boyern.pqp</groupId>
    <artifactId>pqp</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>
    <name>Pqp</name>

    <properties>
        <argLine>-Djava.security.egd=file:/dev/./urandom -Xmx256m</argLine>
        <assertj.version>3.6.2</assertj.version>
        <awaitility.version>2.0.0</awaitility.version>
        <commons-io.version>2.5</commons-io.version>
        <commons-lang.version>3.5</commons-lang.version>
        <cucumber.version>1.2.4</cucumber.version>
        <dockerfile-maven-plugin.version>1.3.4</dockerfile-maven-plugin.version>
        <!-- Overridden to get metrics-jcache -->
        <dropwizard-metrics.version>3.2.2</dropwizard-metrics.version>
        <frontend-maven-plugin.version>1.4</frontend-maven-plugin.version>
        <gatling.version>2.2.5</gatling.version>
        <gatling-maven-plugin.version>2.2.4</gatling-maven-plugin.version>
        <hazelcast-hibernate52.version>1.2</hazelcast-hibernate52.version>
        <hibernate.version>5.2.10.Final</hibernate.version>
        <hikaricp.version>2.6.0</hikaricp.version>
        <jacoco-maven-plugin.version>0.7.9</jacoco-maven-plugin.version>
        <java.version>1.8</java.version>
        <jcache.version>1.0.0</jcache.version>
        <jzlib.version>1.1.3</jzlib.version>
        <jhipster.server.version>1.1.9</jhipster.server.version>
        <jjwt.version>0.7.0</jjwt.version>
        <liquibase-hibernate5.version>3.6</liquibase-hibernate5.version>
        <liquibase-slf4j.version>2.0.0</liquibase-slf4j.version>
        <logstash-logback-encoder.version>4.11</logstash-logback-encoder.version>
        <m2e.apt.activation>jdt_apt</m2e.apt.activation>
        <mapstruct.version>1.1.0.Final</mapstruct.version>
        <maven-compiler-plugin.version>3.6.0</maven-compiler-plugin.version>
        <maven-enforcer-plugin.version>1.4.1</maven-enforcer-plugin.version>
        <maven-resources-plugin.version>3.0.1</maven-resources-plugin.version>
        <maven.build.timestamp.format>yyyyMMddHHmmss</maven.build.timestamp.format>
        <maven.compiler.source>${java.version}</maven.compiler.source>
        <maven.compiler.target>${java.version}</maven.compiler.target>
        <maven.version>3.0.0</maven.version>
        <metrics-spring.version>3.1.3</metrics-spring.version>
        <node.version>v6.11.1</node.version>
        <problem-spring-web.version>0.20.0</problem-spring-web.version>
        <!-- These remain empty unless the corresponding profile is active -->
        <profile.no-liquibase />
        <profile.swagger />
        <prometheus-simpleclient.version>0.0.20</prometheus-simpleclient.version>
        <!-- Sonar properties -->
        <project.testresult.directory>${project.build.directory}/test-results</project.testresult.directory>
        <run.addResources>false</run.addResources>
        <scala-maven-plugin.version>3.2.2</scala-maven-plugin.version>
        <scala.version>2.12.1</scala.version>
        <sonar-maven-plugin.version>3.2</sonar-maven-plugin.version>

        <sonar.exclusions>src/main/webapp/content/**/*.*, src/main/webapp/bower_components/**/*.*, src/main/webapp/i18n/*.js, target/www/**/*.*</sonar.exclusions>

        <sonar.issue.ignore.multicriteria>S3437,UndocumentedApi,BoldAndItalicTagsCheck</sonar.issue.ignore.multicriteria>

        <!-- Rule https://sonarqube.com/coding_rules#rule_key=Web%3ABoldAndItalicTagsCheck is ignored. Even if we agree that using the "i" tag is an awful practice, this is what is recommended by http://fontawesome.io/examples/ -->
        <sonar.issue.ignore.multicriteria.BoldAndItalicTagsCheck.resourceKey>src/main/webapp/app/**/*.*</sonar.issue.ignore.multicriteria.BoldAndItalicTagsCheck.resourceKey>
        <sonar.issue.ignore.multicriteria.BoldAndItalicTagsCheck.ruleKey>Web:BoldAndItalicTagsCheck</sonar.issue.ignore.multicriteria.BoldAndItalicTagsCheck.ruleKey>
        <!-- Rule https://sonarqube.com/coding_rules#rule_key=squid%3AS3437 is ignored, as a JPA-managed field cannot be transient -->
        <sonar.issue.ignore.multicriteria.S3437.resourceKey>src/main/java/**/*</sonar.issue.ignore.multicriteria.S3437.resourceKey>
        <sonar.issue.ignore.multicriteria.S3437.ruleKey>squid:S3437</sonar.issue.ignore.multicriteria.S3437.ruleKey>
        <!-- Rule http://sonarqube.com/coding_rules#rule_key=squid%3AUndocumentedApi is ignored, as we want to follow "clean code" guidelines and classes, methods and arguments names should be self-explanatory -->
        <sonar.issue.ignore.multicriteria.UndocumentedApi.resourceKey>src/main/java/**/*</sonar.issue.ignore.multicriteria.UndocumentedApi.resourceKey>
        <sonar.issue.ignore.multicriteria.UndocumentedApi.ruleKey>squid:UndocumentedApi</sonar.issue.ignore.multicriteria.UndocumentedApi.ruleKey>

        <sonar.jacoco.itReportPath>${project.testresult.directory}/coverage/jacoco/jacoco-it.exec</sonar.jacoco.itReportPath>
        <sonar.jacoco.reportPath>${project.testresult.directory}/coverage/jacoco/jacoco.exec</sonar.jacoco.reportPath>
        <sonar.java.codeCoveragePlugin>jacoco</sonar.java.codeCoveragePlugin>

        <sonar.javascript.jstestdriver.reportsPath>${project.testresult.directory}/karma</sonar.javascript.jstestdriver.reportsPath>
        <!-- For Sonar < 6.2 -->
        <sonar.javascript.lcov.reportPath>${project.testresult.directory}/coverage/report-lcov/lcov.info</sonar.javascript.lcov.reportPath>
        <!-- For Sonar >= 6.2 -->
        <sonar.javascript.lcov.reportPaths>${project.testresult.directory}/coverage/report-lcov/lcov.info</sonar.javascript.lcov.reportPaths>

        <sonar.sources>${project.basedir}/src/main/</sonar.sources>
        <sonar.surefire.reportsPath>${project.testresult.directory}/surefire-reports</sonar.surefire.reportsPath>
        <sonar.tests>${project.basedir}/src/test/</sonar.tests>

        <!-- Spring properties -->
        <springfox.version>2.7.0</springfox.version>
        <validation-api.version>1.1.0.Final</validation-api.version>
        <yarn.version>v0.27.5</yarn.version>
    </properties>
pom.xml上的

问题 enter image description here

1 个答案:

答案 0 :(得分:1)

项目源文件夹配置不正确:项目文件夹而不是src/main/javasrc/main/resources设置为错误的源文件夹。

对于Maven项目,Maven项目构建器应根据pom.xml文件的内容设置源文件夹。因此,检查pom.xml文件是否有错误。在您的情况下,pom.xml文件中的错误消息可能表示无效的本地Maven存储库。删除存储库可能会解决您的问题。