简体   繁体   English

不在IntelliJ的maven目标目录下创建的类文件

[英]class files not created under maven target directory in IntelliJ

I have created a simple maven project to create shaded jar. 我已经创建了一个简单的Maven项目来创建阴影罐。 I built it using mvn clean compile .It creates jar file but after extracting it i don't see .class files corresponding to my project java source files. 我使用mvn clean compile构建了它。它创建了jar文件,但在解压缩后我看不到与我的项目Java源文件相对应的.class文件。 I see clearly below message when i build but don't see any .class files under target dir. 在构建时,我在消息下方清楚看到了,但是在目标目录下看不到任何.class文件。

[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ PersonalizationFeeder --- [INFO] --- maven-compiler-plugin:3.1:compile(default-compile)@ PersonalizationFeeder ---

[INFO] Changes detected - recompiling the module! [INFO]检测到更改-重新编译模块!

[WARNING] File encoding has not been set, using platform encoding UTF-8, ie build is platform dependent! [警告]尚未使用平台编码UTF-8设置文件编码,即构建依赖于平台!

[INFO] Compiling 10 source files to Documents/PersonalizationFeeder/target/classes [INFO] ------------------------------------------------------------------------ [INFO]将10个源文件编译为Documents / PersonalizationFeeder / target / classs [INFO] -------------------------------- ----------------------------------------

[INFO] BUILD SUCCESS [INFO]建立成功

What is the problem here? 这里有什么问题? My pom.xml looks like this. 我的pom.xml看起来像这样。

<?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/xsd/maven-4.0.0.xsd">
<parent>
    <artifactId>data-analytics</artifactId>
    <groupId>com.wooplr</groupId>
    <version>0.0.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>PersonalizationFeeder</artifactId>
<packaging>jar</packaging>
<properties>
    <userlib.dir>Documents/userlibs</userlib.dir>
</properties>

<dependencies>
    <dependency>
        <groupId>org.apache.spark</groupId>
        <artifactId>spark-core_2.10</artifactId>
        <version>${spark.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.spark</groupId>
        <artifactId>spark-streaming-kafka_2.10</artifactId>
        <version>${spark.version}</version>
    </dependency>        
    <dependency>
        <groupId>com.wooplr</groupId>
        <artifactId>jedis</artifactId>
        <version>1.0</version>
        <scope>system</scope>
        <systemPath>${userlib.dir}/jedis-2.7.3.jar</systemPath>
    </dependency>
</dependencies>

<build>
<sourceDirectory>src/main/java</sourceDirectory>
<plugins>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
            <source>1.7</source>
            <target>1.7</target>
        </configuration>
    </plugin>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>2.2</version>
        <executions>
            <execution>
                <phase>package</phase>
                <goals>
                    <goal>shade</goal>
                </goals>
                <configuration>
                    <artifactSet>
                        <excludes>
                            <exclude>junit:junit</exclude>

                            <exclude>org.apache.maven:lib:tests</exclude>
                        </excludes>
                    </artifactSet>
                    <filters>
                        <filter>
                            <!--<artifact>*:*</artifact>-->
                            <excludes>
                                <excludeScope>system</excludeScope>
                                <exclude>META-INF/*.SF</exclude>
                                <exclude>META-INF/*.DSA</exclude>
                                <exclude>META-INF/*.RSA</exclude>
                            </excludes>
                        </filter>
                    </filters>
                </configuration>
            </execution>
        </executions>
    </plugin>
</plugins>

Problem solved...!! 问题解决了...!! In one of the dependency jars, there is licenced jar and because of which it couldn't build properly. 在其中一个依赖项jar中,有一个许可的jar,因此无法正确构建。 To solve the problem,I had to extract that particular dependency jar and remove .RSA,.DSA and *.SF files from META-INF/ dir and then make it jar using jar -cf command and then use this new jar as dependency. 要解决该问题,我必须提取特定的依赖项jar并从META-INF /目录中删除.RSA,.DSA和* .SF文件,然后使用jar -cf命令将其设为jar,然后使用此新jar作为依赖项。 It worked fine for me. 对我来说很好。 Thanks all. 谢谢大家

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM