Maven: JAR will be empty - no content was marked for inclusion

前端 未结 2 1403
死守一世寂寞
死守一世寂寞 2020-12-05 18:22

I have a minor problem with maven. When I run the command mvn package I get the following warning:

[WARNING] JAR will be empty - no content was marked for in

相关标签:
2条回答
  • 2020-12-05 19:14

    I hope you have good reason not to follow the standard directory layout, otherwise consider to rearrange the folders: it will make your life a lot easier (as well as for your co-workers). My guess is that nothing has been compiled. In that case: removing the configuration of the maven-compiler-plugin should be enough.

    0 讨论(0)
  • 2020-12-05 19:18

    Please try this one:

    <build>
      <finalName>${project.artifactId}-${project.version}</finalName>
      <sourceDirectory>src</sourceDirectory>
      <testSourceDirectory>test</testSourceDirectory>
      <resources>
        <resource>
          <directory>src</directory>
          <excludes>
            <exclude>**/*.java</exclude>
          </excludes>
        </resource>
      </resources>
      <testResources>
        <testResource>
          <directory>test</directory>
          <excludes>
            <exclude>**/*.java</exclude>
          </excludes>
        </testResource>
      </testResources>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>${maven-compiler-plugin.version}</version>
          <configuration>
            <source>${maven.compiler.source}</source>
            <target>${maven.compiler.target}</target>
          </configuration>
        </plugin>
      </plugins>
    
    </build>
    

    If you want to convert an existing Eclipse Java Project just right click on Java Project and click Configure/Convert to Maven Project.

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