首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何向Maven POM添加Websphere应用服务器自由配置文件运行时依赖项?

如何向Maven POM添加Websphere应用服务器自由配置文件运行时依赖项?
EN

Stack Overflow用户
提问于 2014-08-12 13:40:56
回答 2查看 10.6K关注 0票数 4

我有一个restful应用程序,我将其转换为maven项目。现在,由于找不到java/openjpa包,所以在使用maven compile时会出现编译错误。下面是我的POM文件

代码语言:javascript
复制
<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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>portal</groupId>
  <artifactId>portal</artifactId>
  <packaging>war</packaging>
  <version>0.0.1-SNAPSHOT</version>
  <name>developer-portal</name>
  <url>http://maven.apache.org</url>

  <properties>
    <serverName>dropServer</serverName>
    <serverHome>C:\wlp</serverHome>
    <maven.compiler.source>1.7</maven.compiler.source>
    <maven.compiler.target>1.7</maven.compiler.target>
  </properties>

  <pluginRepositories>
    <pluginRepository>
        <id>Liberty</id>
        <name>Liberty Repository</name>
        <url>http://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/wasdev/maven/repository/</url>
        <layout>default</layout>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
        <releases>
            <enabled>true</enabled>
        </releases>
    </pluginRepository>
  </pluginRepositories>

  <dependencies>
    <dependency>
        <groupId>com.ibm.tools.target</groupId>
        <artifactId>was-liberty</artifactId>
        <version>8.5.5</version>
        <type>pom</type>
        <scope>provided</scope>
    </dependency>
    <!-- Hard-Coded, made-up dependency -->
    <dependency>
        <groupId>com.ibm.nosql</groupId>
        <artifactId>nosqljson</artifactId>
        <version>1.0</version>
        <scope>system</scope>
        <systemPath>C:\javalib\db2_drivers\nosqljson.jar</systemPath>
    </dependency>
    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-server</artifactId>
        <version>1.18</version>
    </dependency>
    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-grizzly2</artifactId>
        <version>1.18</version>
    </dependency>
    <dependency>
        <groupId>org.codehaus.jackson</groupId>
        <artifactId>jackson-jaxrs</artifactId>
        <version>1.9.11</version>
    </dependency>
    <dependency>
        <groupId>com.sun.jersey.jersey-test-framework</groupId>
        <artifactId>jersey-test-framework-core</artifactId>
        <version>1.17.1</version>
    </dependency>
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-email</artifactId>
        <version>1.3.2</version>
    </dependency>
  </dependencies>

  <build>
    <finalName>developer-portal</finalName>
    <plugins>
        <plugin>
            <groupId>com.ibm.websphere.wlp.maven.plugins</groupId>
            <artifactId>liberty-maven-plugin</artifactId>
            <version>1.0</version>
            <executions>
                <execution>
                    <id>start-server</id>
                    <phase>pre-integration-test</phase>
                    <goals>
                        <goal>start-server</goal>
                    </goals>
                    <configuration>
                        <serverHome>${serverHome}</serverHome>
                        <serverName>${serverName}</serverName>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>com.ibm.websphere.wlp.maven.plugins</groupId>
            <artifactId>liberty-maven-plugin</artifactId>
            <version>1.0</version>
            <configuration>
                <serverHome>${serverHome}</serverHome>
                <serverName>${serverName}</serverName>
            </configuration>
            <executions>
                <execution>
                    <id>deployapp</id>
                    <phase>pre-integration-test</phase>
                    <goals>
                        <goal>deploy</goal>
                    </goals>
                    <configuration>
                        <appArchive>${project.build.directory}/${project.name}.war</appArchive>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
  </build>

</project>

下面是eclipse中的特殊错误:

代码语言:javascript
复制
Missing artifact com.ibm.tools.target:was-liberty:pom:8.5.5

在CLI:

未能在项目开发人员-门户上执行目标:无法解决项目开发人员的依赖关系-porta l:developer-门户:war:0.0.1-快照:未能找到com.ibm.tools.Target: was - find :pom:8.5.5在http://repo.maven.apache.org/ maven2中缓存在本地存储库中,在中央更新间隔过去或更新被迫->帮助1之前,不会重新尝试解决方案

参考文献:

  1. https://www.ibm.com/developerworks/community/forums/html/topic?id=e98d726e-6f5d-470c-a042-dd8b41384235
  2. beta/com.ibm.websphere.wdt.doc/topics/localrepo.htm?lang=en
EN

回答 2

Stack Overflow用户

发布于 2014-08-12 13:55:12

问题是maven只是查看中央存储库。要添加IBM的存储库,需要在POM中添加以下内容:

代码语言:javascript
复制
  <repositories>
    <repository>
        <id>Liberty</id>
        <name>Liberty Repository</name>
        <url>http://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/wasdev/maven/repository/</url>
    </repository>  
 </repositories>
票数 7
EN

Stack Overflow用户

发布于 2014-08-13 14:17:05

有两件事要做:设置IBM存储库并将适当的依赖项添加到POM中。您可以查看下面的链接,以获得有关这两种操作的说明。

  • 8.5.5/com.ibm.websphere.wdt.doc/topics/setibmrep.htm
  • 8.5.5/com.ibm.websphere.wdt.doc/topics/localrepo.htm
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/25265840

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档