Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Maven清单文件问题_Java_Eclipse_Maven_Jar - Fatal编程技术网

Java Maven清单文件问题

Java Maven清单文件问题,java,eclipse,maven,jar,Java,Eclipse,Maven,Jar,我已经为此挣扎了一段时间。我有一个Maven项目,只需解决一个问题即可构建和打包。我有一个我正在使用的罐子,它不在我公司版本的NEXUS中。我通过以下命令行命令将jar添加到我的.m2存储库中: mvn安装:安装文件-Dfile=c:/u/lib/terajdbc4-15.00.00.20.jar-DgroupId=com.teradata-DartifactId=terajdbc4-Dversion=15.00.00.20-dpackage=jar 构建jar时,此jar不会附加到清单文件。因

我已经为此挣扎了一段时间。我有一个Maven项目,只需解决一个问题即可构建和打包。我有一个我正在使用的罐子,它不在我公司版本的NEXUS中。我通过以下命令行命令将jar添加到我的
.m2
存储库中:

mvn安装:安装文件-Dfile=c:/u/lib/terajdbc4-15.00.00.20.jar-DgroupId=com.teradata-DartifactId=terajdbc4-Dversion=15.00.00.20-dpackage=jar

构建jar时,此jar不会附加到清单文件。因此,当我需要这个jar时,代码就会死掉,因为它找不到它正在寻找的资源(teradata驱动程序)

除了我已经添加到清单中的其他jar之外,还有什么方法可以将这个jar添加到清单文件中

以下是父pom文件的构建部分:

<build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>2.3.1</version>
                    <configuration>
                        <source>1.7</source>
                        <target>1.7</target>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <version>2.6</version>
                <executions>
                    <execution>
                        <id>copy-resources</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${basedir}/target/Crunchify</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>resources</directory>
                                    <filtering>true</filtering>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-dependencies</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/Crunchify/lib</outputDirectory>
                            <overWriteReleases>false</overWriteReleases>
                            <overWriteSnapshots>false</overWriteSnapshots>
                            <overWriteIfNewer>true</overWriteIfNewer>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifest>
                            <addClasspath>true</addClasspath>
                            <classpathPrefix>lib/</classpathPrefix>
                            <mainClass>ap.invalert.handler.InvAlertHandler</mainClass>
                        </manifest>             
                        <manifestEntries>
                            <Class-Path>.</Class-Path>          
                        </manifestEntries>                      
                    </archive>               
                    <finalName>Crunchify/Crunchify</finalName>
                </configuration>
            </plugin>
        </plugins>
    </build>

org.apache.maven.plugins
maven编译器插件
2.3.1
1.7
1.7
maven资源插件
2.6
复制资源
验证
复制资源
${basedir}/target/Crunchify
资源
真的
org.apache.maven.plugins
maven依赖插件
复制依赖项
准备包装
复制依赖项
${project.build.directory}/Crunchify/lib
假的
假的
真的
org.apache.maven.plugins
maven jar插件
真的
解放党/
ap.invalert.handler.InvAlertHandler
.          
Crunchify/Crunchify

如果您在~/.m2的本地repo中成功地“安装”了该文件,您应该查看GAV(groupID、artifactID、version)和依赖项的范围。也许您没有正确指定安装的JAR文件的版本,以便
maven JAR插件
获取它?为什么不将此JAR添加到Nexus中的第三方库中?Kedar Mhaswade-谢谢。我在这个jar的依赖项中有一个标记jar,它阻止了jar定义写入清单。如果您已经成功地在~/.m2的本地repo中“安装”了该文件,那么您应该查看GAV(groupID、artifactID、version)和依赖项的范围。也许您没有正确指定安装的JAR文件的版本,以便
maven JAR插件
获取它?为什么不将此JAR添加到Nexus中的第三方库中?Kedar Mhaswade-谢谢。我在这个jar的依赖项中有一个标记jar,它阻止jar定义写入清单。