如何将 Websphere Application Server Liberty Profile 运行时依赖项添加到 Maven POM?

2024-03-06

我有一个宁静的应用程序,我将其转换为 Maven 项目。现在,我在使用时遇到编译错误maven compile因为找不到 java-ee/openjpa 包。下面是我的POM文件

<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 中的特定错误:

Missing artifact com.ibm.tools.target:was-liberty:pom:8.5.5

在 CLI 中:

[错误] 无法在项目开发人员门户上执行目标:无法 解决项目developer-porta的依赖关系 l:developer-portal:war:0.0.1-SNAPSHOT: 找不到 com.ibm.tools.target:was-liberty:pom:8.5.5 中http://repo.maven.apache.org/ http://repo.maven.apache.org/maven2已缓存在本地 存储库,在更新之前不会重新尝试解析 Central 的间隔已过或强制更新 -> [帮助 1]

参考:

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

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

  <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>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何将 Websphere Application Server Liberty Profile 运行时依赖项添加到 Maven POM? 的相关文章

随机推荐