IntelliJ

时间:2016-05-19 09:21:09

标签: java maven intellij-idea

我创建了一个简单的maven项目来创建阴影jar。我使用mvn clean compile构建它。它创建了jar文件,但在解压后我没有看到与我的项目java源文件对应的.class文件。我在构建时看到下面的消息,但在目标目录下没有看到任何.class文件。

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

[INFO]检测到更改 - 重新编译模块!

[警告]尚未使用平台编码UTF-8设置文件编码,即构建依赖于平台!

[INFO]将10个源文件编译为Documents / PersonalizationFeeder / target / classes [INFO] ----------------------------------------------- -------------------------

[INFO]建立成功

这是什么问题?我的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>

1 个答案:

答案 0 :(得分:0)

问题解决了...... !!在其中一个依赖jar中,有许可jar,因此无法正常构建。为了解决这个问题,我不得不提取特定的依赖jar并从META-INF / dir中删除.RSA,.DSA和* .SF文件,然后使用jar -cf命令将其设为jar,然后使用这个新jar作为依赖。它对我来说很好。谢谢大家。