如何解决"未能找到javax.transaction:jta:jar:1.0.1B"在maven安装?

时间:2018-01-25 01:16:42

标签: maven dependencies jta

我在" mvn clean install"上收到错误消息命令,如下:

    Failed to execute goal on project image-server-core: 
    Could not resolve dependencies for project com.xxxx:image-server-core:jar:2.0.7: 
Failure to find javax.transaction:jta:jar:1.0.1B in
    http://repo1.maven.org/maven2 was cached in the local repository, resolution
    will not be reattempted until the update interval of repo1.maven.org has elapsed or updates are forced -> 

我做了一些谷歌搜索,并尝试添加以下依赖

<dependency>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
<version>1.1</version>
</dependency>

但它只是说禁止访问。虽然这似乎是一个相当常见的错误,但我对maven的理解非常有限 - 例如,如何跟踪链接到javax.transaction的依赖关系:jta:jar:1.0.1B?更重要的是,我该如何解决这个问题?

这是pom.xml:

<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">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>com.xxxx</groupId>
        <artifactId>image-server</artifactId>
        <version>2.0.7</version>
    </parent>

    <artifactId>image-server-core</artifactId>
    <version>2.0.7</version>
    <packaging>jar</packaging>
    <name>xxxx-${project.artifactId}</name>

    <build>
        <finalName>${project.name}</finalName>
        <pluginManagement>
            <plugins>
                <!--This plugin's configuration is used to store Eclipse m2e settings 
                    only. It has no influence on the Maven build itself. -->
                <plugin>
                    <groupId>org.eclipse.m2e</groupId>
                    <artifactId>lifecycle-mapping</artifactId>
                    <version>1.0.0</version>
                    <configuration>
                        <lifecycleMappingMetadata>
                            <pluginExecutions>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>
                                            org.apache.maven.plugins
                                        </groupId>
                                        <artifactId>
                                            maven-jar-plugin
                                        </artifactId>
                                        <versionRange>
                                            [2.6,)
                                        </versionRange>
                                        <goals>
                                            <goal>test-jar</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore></ignore>
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <dependencies>
        <dependency>
            <groupId>com.xxx</groupId>
            <artifactId>image-server-utils</artifactId>
            <version>1.0.7</version>
        </dependency>
        <dependency>
            <groupId>com.xxxx.otblib</groupId>
            <artifactId>otblib</artifactId>
            <version>1.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.xxxx.model</groupId>
            <artifactId>VisionServerModels</artifactId>
            <version>1.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.xxxx.image-server</groupId>
            <artifactId>image-server-rest</artifactId>
            <version>1.0.7</version>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.ftpserver</groupId>
            <artifactId>ftpserver-core</artifactId>
            <version>1.0.6.1C</version>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.mina</groupId>
                    <artifactId>mina-core</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.ftpserver</groupId>
            <artifactId>ftplet-api</artifactId>
            <version>1.0.6.1C</version>
        </dependency>
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-core</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty</artifactId>
            <version>3.5.7.Final</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.16</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.sun.jersey</groupId>
            <artifactId>jersey-bundle</artifactId>
            <version>1.19.1</version>
        </dependency>
        <dependency>
            <groupId>org.modelmapper</groupId>
            <artifactId>modelmapper</artifactId>
            <scope>provided</scope>
        </dependency>


        <!-- Test Jars -->
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
</project>

2 个答案:

答案 0 :(得分:0)

根据你的pom.xml,我发现了hibernate maven依赖,但是你的hibernate版本是什么?如果你像下面那样更新hibernate:

<dependency>
 <groupId>org.hibernate</groupId>
 <artifactId>hibernate</artifactId>
 <version>3.3.2.ga</version>
</dependency>

它有一个推荐的jta依赖项。所以更新你的hibernate版本。 更多细节:maven missing dependency jta-1.0.1b

还有,你的pom.xml都有log4j和logback maven依赖。请看一下log4j和logback:log4j vs logback之间的区别,如果你想使用logback而不是log4j,你会删除log4j maven依赖,还要添加slf4j maven依赖:

 <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>1.7.25</version>
    </dependency>

答案 1 :(得分:0)

由于maven存储库中不存在此依赖项,因此可以将其直接添加到本地存储库中。首先从Oracle网站https://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-database-419422.html

下载jar。

文件名将为 jdbc2_stdext.jar 或类似名称。

现在您可以使用以下命令将其安装在本地Maven中:

mvn install:install-file -DgroupId=javax.sql -DartifactId=jdbc-stdext -Dversion=2.0 -Dpackaging=jar -Dfile=jdbc-stdext.jar