Pregunta

Soy bastante nuevo en Jboss EAP 6+ y Maven.

He creado un proyecto de muestra utilizando el complemento de la herramienta JBoss de Eclipse y se implementa a través de Eclipse.

No instalé Maven por separado, vino con el enchufe anterior, supongo.

Según mi conocimiento, Maven descarga todos los archivos JAR requeridos que se mencionan en el archivo .POM en el repositorio local. En mi caso .m2 \ repositorio \ ubicación.

Pero no entiendo cómo JBoss refiere esta ubicación cuando se ejecuta individualmente en un servidor de producción. Allí no tenemos ninguna herramienta de eclipse o jboss.

Revisé el archivo .pom en proyecto implementado y aún no noté ninguna referencia de ubicación. Técnicamente no puedo entender cómo funciona esto. Es realmente útil si alguien puede explicar un poco más.

Mi pregunta es, si subo mi proyecto a un JBoss diferente en un servidor diferente, ¿se cargará automáticamente todos los frascos requeridos que se mencionan en el archivo iPOM cuando se implementan? Si es así, ¿cuál es la ubicación? ¿Cómo puedo cambiar esa ubicación?

¿Cuál es el procedimiento exacto que tengo que seguir al configurar un tipo de entorno de producción (sujeto al repositorio de Maven)?

Simplemente copie mi JBoss junto con el proyecto desplegado para el entorno de producción, ¡entonces puedo esperar el archivo JBoss y el proyecto. PRESIONES CUIDADO DE FAMILLOS Y PREPENDIENCIAS?

¿O necesito instalar y configurar Maven y repositorio en el entorno de producción? Lo que entendí puede incorrecto en absoluto. Realmente aprecio si puedes ayudarme en esto.

gracias

Por favor, encuentre el archivo .pom en el proyecto implementado.

<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>

¿Fue útil?

Solución

JBoss no se descarga ni intenta encontrar ninguna de su aplicación declarada dependencias fuera de su aplicación o fuera de sus módulos o lib.

Es una vista de 10000 pies de cómo Maven los paquetes o oreja:

  • primero se ve si una dependencia declarada ya está en su repositorio local
  • Segundo si no lo es, trata de descargar cada dependencia declarada del repositorio central de Maven, entonces si no está allí, intenta descargar de cualquier repositorio activo declarado en su POM.xml y en su configuración .xml
  • Cada vez que descarga una dependencia que analiza su POM.XML y descarga recursivamente sus dependencias utilizando el mismo procedimiento descrito en el primer y segundo pasos
  • Después de que Maven descarga las dependencias, utiliza Javac para compilar su proyecto y colecciona cada dependencia declarada como "dependencia de compilación" en algún lugar del directorio de destino, por lo que cuando paquen su proyecto, las dependencias de compilación serán dentro Su paquete. Tenga en cuenta que si no declara el tipo de dependencia, tiene, por defecto, "compila la dependencia"
  • Sin dependencias declaradas como tiempo de ejecución o proporcionadas se empaquetarán dentro de su aplicación y deben estar presentes en un módulo JBOSS o el JBOSS LIB o su aplicación no se implementará correctamente.

Por supuesto, esta vista de 10000 pies de cómo los paquetes de Maven una guerra u oreja no describen ninguna de las 17 fases del ciclo de vida de la compilación del paquete. Una buena referencia al ciclo de vida de la construcción está en http:// maven. apache.org/guides/introduction/introduction-to-the-lifecycle.html , y la buena introducción al mecanismo de dependencia es en http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html y http://maven.apache.org/guides/introduction/introduction-to- opcional-y-excluidos-dependences.html

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top