使用Java项目

时间:2016-04-18 01:36:29

标签: java eclipse maven

出于某种原因,我在尝试在maven中构建项目时遇到三个依赖性错误,它们是:

[错误]无法在项目上执行目标tolmarInventory:无法解析项目的依赖项tolmar.inventory.app:tolmarInventory:jar:0.0.1-SNAPSHOT:无法解析以下工件:com.android.support: support-annotations:jar:23.1.0,android.support:compatibility-v7:apklib:23.0.1,com.android.support:appcompat-v7:jar:23.0.1:找不到com.android.support:support -annotations:jar:https://repo.maven.apache.org/maven2中的23.1.0缓存在本地存储库中,在中心的更新间隔过去或强制更新之前,不会重新尝试解析 - > [帮助1]

档案位置: C:\用户\ John.m2 \库\ COM \机器人\支持\支持的注解\ 23.1.0

C:\用户\ John.m2 \库\ COM \机器人\支持\程序兼容性-V7 \ 23.0.1

我查看m2存储库,它说我的版本是v7 23.0.1和23.1.0。我不确定为什么我需要这些Android依赖项来进行不会在手机上运行的JavaFX项目。我在网上找到的所有内容都指的是Android SDK,我没有在这个项目中使用它,所以我很困惑。也许这些文件的名称不正确?我不知道该怎么做,我已经看了很多关于maven的教程,并且已经阅读了很多人已经有过的问题,我只是想不通知在这里做什么。这些依赖项是否适用于Java项目?谢谢!

POM信息是:

<?xml version="1.0" encoding="UTF-8"?>

http://maven.apache.org/xsd/maven-4.0.0.xsd“&GT;

<modelVersion>4.0.0</modelVersion>

<groupId>tolmar.inventory.app</groupId>
<artifactId>tolmarinventoryapplication</artifactId>
<name>tolmarinventoryapplication</name>

<packaging>jar</packaging>
<version>0.0.1-SNAPSHOT</version>

<organization>
    <!-- Used as the 'Vendor' for JNLP generation -->
    <name>Kirch Industries</name>
</organization>

<properties>
    <slf4j.version>1.7.12</slf4j.version>
    <log4j.version>1.2.17</log4j.version>
</properties>


<build>

    <finalName>tolmarinventoryapplication</finalName>

    <plugins>

        <plugin>
            <groupId>com.zenjava</groupId>
            <artifactId>javafx-maven-plugin</artifactId>
            <version>8.1.5</version>
            <configuration>

                <mainClass>tolmar.inventory.app.tolmarinventoryapplication.MainApp</mainClass>

                <!-- only required if signing the jar file -->
                <keyStoreAlias>example-user</keyStoreAlias>
                <keyStorePassword>example-password</keyStorePassword>
                <allPermissions>true</allPermissions>

            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>

    </plugins>
</build>


<dependencies>

    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.12</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>com.sun.mail</groupId>
        <artifactId>javax.mail</artifactId>
        <version>1.5.5</version>
    </dependency>
    <dependency>
        <groupId>org.lucee</groupId>
        <artifactId>commons-io</artifactId>
        <version>2.4.0</version>
    </dependency>
    <dependency>
        <groupId>com.pushtorefresh.storio</groupId>
        <artifactId>sqlite</artifactId>
        <version>1.8.0</version>
    </dependency>
    <dependency>
        <groupId>com.android.tools</groupId>
        <artifactId>sdklib</artifactId>
        <version>25.0.0</version>
    </dependency>


    <!-- MigLayout -->

    <dependency>
        <groupId>com.miglayout</groupId>
        <artifactId>miglayout-javafx</artifactId>
        <version>5.0</version>
    </dependency>

    <!-- Apache Commons -->

    <dependency>
        <groupId>commons-lang</groupId>
        <artifactId>commons-lang</artifactId>
        <version>2.6</version>
    </dependency>

    <!-- Logging  -->

    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>${slf4j.version}</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>jcl-over-slf4j</artifactId>
        <version>${slf4j.version}</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>${slf4j.version}</version>
    </dependency>
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>${log4j.version}</version>
    </dependency>

    <dependency>
        <groupId>com.zenjava</groupId>
        <artifactId>javafx-maven-plugin</artifactId>
        <version>8.4.0</version>
        <type>maven-plugin</type>
    </dependency>
</dependencies>

这是我试图打包的第一个程序,这很难,谢谢你的帮助!我无法弄清楚如何将此依赖项添加到本地maven存储库,我已经获取了我拥有的那些jar文件并将它们手动添加到存储库中,但我不确定它是否正确。

1 个答案:

答案 0 :(得分:-1)

如果项目不需要它们,您可以查看pom.xml文件并删除声明这些jar的<dependency>标记并删除这些依赖项。