JBoss EAP 6+およびMavenリポジトリの実行時間参照場所
-
24-12-2019 - |
質問
JBoss EAP 6+とMavenにはかなり新しい。
EclipseのJBoss Tool Plug-inを使用してサンプルプロジェクトを作成し、Eclipse経由で展開しました。
私はMavenを別々にインストールしませんでした、それは上記のプラグインで来ました私は推測します。
私の知り上げによると、Mavenはローカルリポジトリに.pomファイルに記載されているすべての必要なJARファイルをダウンロードします。私の場合.m2 \リポジトリ\ location。
しかし、JBossが本番サーバーで個別に実行されたときにこの場所をどのように参照するかを理解していません。そこにはEclipseやJBoss Toolがありません。
私は展開されたプロジェクトで.pomファイルをチェックし、それでも私は場所参照に気付かなかった。
技術的には、これがどのように機能するかを理解できません。誰かがさらにビットを説明できる場合は本当に役に立ちます。
私の質問は、プロジェクトを別のサーバーで異なるJBossにアップロードした場合、デプロイ時に.pomファイルで述べたすべての必要なjarを自動的にダウンロードしますか?もしそうなら場所は何ですか?どのように私はその場所を変更できますか?
環境の種類を設定するときに従う必要がある正確な手順は何ですか?(Mavenリポジトリの対象)?
JBossを展開したプロジェクトとプロジェクト環境にコピーするだけで、JBossとProject .pomファイルがjarsと依存関係の世話をすることができますか?
または、製造環境でMavenとリポジトリをインストールして設定する必要がありますか?
私が理解しているのは誤っているかもしれません。あなたがこれについて私を助けることができるならば、それは本当に感謝しています。
ありがとう
展開プロジェクトで.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>org.jboss.tools.example.html5</groupId>
<artifactId>jboss-as-kitchensink-html5-mobile</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>jboss-as-kitchensink-html5-mobile</name>
<description>A Java EE 6 HTML5 mobile web application for use with JBoss.</description>
<url>http://jboss.org/aerogear</url>
<properties>
<!-- Explicitly declaring the source encoding eliminates the following message: -->
<!-- [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- You can reference property in pom.xml or filtered resources (must enable third-party plugin if using Maven < 2.1) -->
<!-- JBoss dependency versions -->
<version.jboss.maven.plugin>7.4.Final</version.jboss.maven.plugin>
<!-- Alternatively, comment out the above line, and un-comment the
line below to use version 7.2.0.Final-redhat-8 which is a release certified
to work with JBoss EAP 6. It requires you have access to the JBoss EAP 6
maven repository. -->
<!-- <version.jboss.as>7.2.0.Final-redhat-8</version.jboss.as> -->
<!-- Define the version of the JBoss BOMs we want to import to specify tested stacks. -->
<version.jboss.bom>1.0.7.Final</version.jboss.bom>
<!-- Alternatively, comment out the above line, and un-comment the line
below to use version 1.0.4.Final-redhat-wfk-2 which is a release certified to
work with JBoss EAP 6. It requires you have access to the JBoss EAP 6
maven repository. -->
<!-- <version.jboss.bom>1.0.4.Final-redhat-wfk-2</version.jboss.bom>> -->
<!-- Other dependency versions -->
<version.org.eclipse.m2e>1.0.0</version.org.eclipse.m2e>
<version.ro.isdc.wro4j>1.4.4</version.ro.isdc.wro4j>
<!-- other plugin versions -->
<version.surefire.plugin>2.10</version.surefire.plugin>
<version.war.plugin>2.2</version.war.plugin>
<!-- maven-compiler-plugin -->
<maven.compiler.target>1.6</maven.compiler.target>
<maven.compiler.source>1.6</maven.compiler.source>
</properties>
<licenses>
<license>
<name>Apache License, Version 2.0</name>
<distribution>repo</distribution>
<url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
</license>
</licenses>
<dependencyManagement>
<dependencies>
<!-- JBoss distributes a complete set of Java EE 6 APIs including
a Bill of Materials (BOM). A BOM specifies the versions of a "stack" (or
a collection) of artifacts. We use this here so that we always get the correct
versions of artifacts. Here we use the jboss-javaee-6.0-with-tools stack
(you can read this as the JBoss stack of the Java EE 6 APIs, with some extras
tools for your project, such as Arquillian for testing) and the jboss-javaee-6.0-with-hibernate
stack you can read this as the JBoss stack of the Java EE 6 APIs, with extras
from the Hibernate family of projects) -->
<dependency>
<groupId>org.jboss.bom</groupId>
<artifactId>jboss-javaee-6.0-with-tools</artifactId>
<version>${version.jboss.bom}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.jboss.bom</groupId>
<artifactId>jboss-javaee-6.0-with-hibernate</artifactId>
<version>${version.jboss.bom}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- First declare the APIs we depend on and need for compilation. All of them are provided by JBoss -->
<!-- Import the CDI API, we use provided scope as the API is included in JBoss -->
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
<scope>provided</scope>
</dependency>
<!-- Import the Common Annotations API (JSR-250), we use provided scope as the API is included in JBoss -->
<dependency>
<groupId>org.jboss.spec.javax.annotation</groupId>
<artifactId>jboss-annotations-api_1.1_spec</artifactId>
<scope>provided</scope>
</dependency>
<!-- Import the JAX-RS API, we use provided scope as the API is included in JBoss -->
<dependency>
<groupId>org.jboss.spec.javax.ws.rs</groupId>
<artifactId>jboss-jaxrs-api_1.1_spec</artifactId>
<scope>provided</scope>
</dependency>
<!-- Import the JPA API, we use provided scope as the API is included in JBoss -->
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.0-api</artifactId>
<scope>provided</scope>
</dependency>
<!-- Import the EJB API, we use provided scope as the API is included in JBoss -->
<dependency>
<groupId>org.jboss.spec.javax.ejb</groupId>
<artifactId>jboss-ejb-api_3.1_spec</artifactId>
<scope>provided</scope>
</dependency>
<!-- Import the Servlet API, we use provided scope as the API is included in JBoss AS 7 -->
<dependency>
<groupId>org.jboss.spec.javax.servlet</groupId>
<artifactId>jboss-servlet-api_3.0_spec</artifactId>
<scope>provided</scope>
</dependency>
<!-- JSR-303 (Bean Validation) Implementation -->
<!-- Provides portable constraints such as @Email -->
<!-- Hibernate Validator is shipped in JBoss -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Now we declare any tools needed -->
<!-- Annotation processor to generate the JPA 2.0 metamodel classes for typesafe criteria queries -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<scope>provided</scope>
</dependency>
<!-- Needed for running tests (you may also use TestNG) -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<!-- Optional, but highly recommended -->
<!-- Arquillian allows you to test enterprise code such as EJBs and Transactional(JTA) JPA from JUnit/TestNG -->
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.protocol</groupId>
<artifactId>arquillian-protocol-servlet</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<!-- Maven will append the version to the finalName (which is the name given to the generated war, and hence the context
root) -->
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>${version.war.plugin}</version>
<configuration>
<!-- Java EE 6 doesn't require web.xml, Maven needs to catch up! -->
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<!-- The JBoss AS plugin deploys your war to a local JBoss AS container -->
<!-- To use, run: mvn package jboss-as:deploy -->
<plugin>
<groupId>org.jboss.as.plugins</groupId>
<artifactId>jboss-as-maven-plugin</artifactId>
<version>${version.jboss.maven.plugin}</version>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<!-- The default profile skips all tests, though you can tune it to run just unit tests based on a custom pattern -->
<!-- Seperate profiles are provided for running all tests, including Arquillian tests that execute in the specified container -->
<id>default</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${version.surefire.plugin}</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<!-- When built in OpenShift the 'openshift' profile will be used when invoking mvn. -->
<!-- Use this profile for any OpenShift specific customization your app will need. -->
<!-- By default that is to put the resulting archive into the 'deployments' folder. -->
<!-- http://maven.apache.org/guides/mini/guide-building-for-different-environments.html -->
<id>openshift</id>
<build>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>${version.war.plugin}</version>
<configuration>
<outputDirectory>deployments</outputDirectory>
<warName>ROOT</warName>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<!-- Use this profile to use the wro4j plugin for validation, concatenation and -->
<!-- minification of JavaScript and CSS files during the build -->
<id>minify</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<build>
<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>${version.org.eclipse.m2e}</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>ro.isdc.wro4j</groupId>
<artifactId>
wro4j-maven-plugin
</artifactId>
<version>${version.ro.isdc.wro4j}</version>
<goals>
<goal>run</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>ro.isdc.wro4j</groupId>
<artifactId>wro4j-maven-plugin</artifactId>
<version>${version.ro.isdc.wro4j}</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<configuration>
<targetGroups>app.min,m.screen.min,d.screen.min</targetGroups>
<cssDestinationFolder>${project.build.directory}/${project.build.finalName}/css/</cssDestinationFolder>
<jsDestinationFolder>${project.build.directory}/${project.build.finalName}/js/</jsDestinationFolder>
<wroManagerFactory>ro.isdc.wro.maven.plugin.manager.factory.ConfigurableWroManagerFactory</wroManagerFactory>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${version.surefire.plugin}</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<!-- An optional Arquillian testing profile that executes tests in your JBoss AS instance -->
<!-- This profile will start a new JBoss AS instance, and execute the test, shutting it down when done -->
<!-- Run with: mvn clean test -Parq-jbossas-managed -->
<id>arq-jbossas-managed</id>
<dependencies>
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-arquillian-container-managed</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</profile>
<profile>
<!-- An optional Arquillian testing profile that executes tests in a remote JBoss AS instance -->
<!-- Run with: mvn clean test -Parq-jbossas-remote -->
<id>arq-jbossas-remote</id>
<dependencies>
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-arquillian-container-remote</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</profile>
<profile>
<id>aerogearci-jbossas-managed-7</id>
<dependencies>
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-arquillian-container-managed</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${version.surefire.plugin}</version>
<configuration>
<systemProperties>
<arquillian.launch>jbossci</arquillian.launch>
<arquillian.jboss_home>${project.build.directory}/jboss-as-${version.jboss.as}/
</arquillian.jboss_home>
</systemProperties>
<includes>
<include>**/*.java</include>
</includes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-as7</id>
<phase>process-test-classes</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-dist</artifactId>
<version>${version.jboss.as}</version>
<outputDirectory>${project.build.directory}</outputDirectory>
<type>zip</type>
<overWrite>false</overWrite>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
. 解決
JBossはダウンロードしたり、アプリケーションの外部またはその外部の依存関係のいずれかを見つけたり、その外部のモジュールやlibの外側にありません。
それはあなたの戦争または耳のパッケージのパッケージのパッケージの10000フィートのビューです:
- 最初に宣言された依存関係がすでにあなたのローカルリポジトリ にあるかどうか
- 2番目であれば、それがMaven Centralリポジトリから宣言された各依存関係をダウンロードしようとすると、それがあなたのpom.xmlとあなたのsettings.xmlで宣言された任意のアクティブなリポジトリからダウンロードしようとするのであれば、それがあればダウンロードしようとするのを試みる。李>
- 依存関係をダウンロードしたときはいつでもPom.xmlを解析し、最初のステップと2番目のステップ で説明したのと同じ手順を使用して再帰的にその依存関係をダウンロードします。
- Mavenが依存関係をダウンロードした後、JavaCを使用してプロジェクトをコンパイルして、プロジェクトをパッケージ化したときに、コンパイル依存関係は内部にの内部に宣言されているので、javacを使用します。 >あなたのパッケージ。デフォルトの依存関係の種類を宣言していない場合は、デフォルトで「コンパイル依存関係」 に宣言してください。
- 実行時または提供された依存関係は、アプリケーション内でパッケージ化され、JBossモジュールまたはJBoss Libに存在しているか、アプリケーションが正しくデプロイされない場合があります。
もちろん、Mavenパッケージのパッケージのパッケンのパッケンのパッケージのパッケージの17段のパッケージビルディングライフサイクルのいずれかを詳細に説明していません。ビルドライフサイクルへの善意は、 http:// mavenです。 apache.org/guides/introduction/introduction-to-the-lifecycle.html 、および依存性メカニズムの概要は http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html と