Domanda

Sono abbastanza nuovo a Jboss EAP 6+ e Maven.

Ho creato un progetto di esempio utilizzando il plug-in JBoss Tool di Eclipse e distribuito tramite Eclipse.

Non ho installato Maven separatamente, è venuto con sopra plug-in suppongo.

Come per la mia conoscenza Maven scarica tutti i file JAR richiesti che sono menzionati nel file. Pom in repository locale. Nel mio caso .m2 \ repository \ location.

Ma non capisco come JBoss riferisce questa posizione quando viene eseguito individualmente in un server di produzione. Lì non abbiamo alcuno strumento Eclipse o JBoss.

Ho controllato il file. Pom in progetto implementato e ancora non ho notato alcun riferimento di posizione. Tecnicamente non riesco a capire come funziona. È davvero utile se qualcuno può spiegare ulteriormente.

La mia domanda è, se carichi il mio progetto su un diverso JBoss in un server diverso, in basso caricare automaticamente tutti i vasi richiesti che menzionavano nel file. Pom quando si distribuisce? Se sì, qual è la posizione? Come posso cambiare quella posizione?

Qual è la procedura esatta che devo seguire quando configura un tipo di ambiente di produzione (soggetto a Maven Repository)?

Basta copiare il mio JBoss insieme al progetto implementato all'ambiente di produzione, quindi posso aspettarmi Jboss e il progetto. PROGETTO. PRENDERE CURA DI JARS E DIAGGITURE?

O devo installare e configurare Maven e Repository in Ambiente di produzione? Quello che ho capito può essere corretto. È davvero apprezzato se puoi aiutarmi su questo.

Grazie

Si prega di trovare il file. Pom in progetto distribuito.

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

È stato utile?

Soluzione

JBoss non scarica o prova a trovare una delle tue app ha dichiarato dipendenze al di fuori dell'applicazione o all'esterno dei suoi moduli o lib.

Questa è una vista di 10000 piedi su come Maven Packages YOU GUERRA o EAR:

    .
  • Prima guarda se una dipendenza dichiarata è già nel tuo repository locale
  • secondo se non lo è, prova a scaricare ciascuna dipendenza dichiarata dal repository centrale di Maven, quindi se non è lì tenta di scaricare da qualsiasi repository attivo dichiarato nel tuo Pom.XML e nelle impostazioni.XML .
  • Ogni volta che scarica una dipendenza che analizza il suo Pom.XML e scarica ricorsivamente le sue dipendenze utilizzando la stessa procedura descritta nel primo e secondo i passaggi
  • Dopo che Maven scarica le dipendenze, utilizza Javac per compilare il tuo progetto e mette ogni dipendenza dichiarata come "dipendenza della compilazione" da qualche parte nella directory di destinazione, quindi quando pacchetta il progetto, le dipendenze della compilazione saranno all'interno Il tuo pacchetto. Si noti che se non dichiari il tipo di dipendenza che hai effettuato il predefinito per "Compilare dipendenza"
  • Nessuna dipendenza dichiarata come runtime o fornita sarà confezionata all'interno dell'applicazione e deve essere presente in un modulo JBoss o JBoss Lib o la tua applicazione non si distribuerà correttamente.

Naturalmente questa vista da 10000 piedi su come i pacchetti di Maven una guerra o un'orecchio non descrivono in dettaglio le 17 fasi del ciclo di vita del pacchetto. Un buon riferimento al ciclo di vita di build è a http:// maven. apache.org/Guides/introduction/introduction-t-the-lifecycle.html e buona introduzione al meccanismo di dipendenza è a http://magen.apache.org/guides/introduction/introduction-to-dependency-mechanism.html e http://maven.apache.org/guides/introduction/introduction- Facoltativo-e-escluse-dipendenze.html

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top