SORU
16 Temmuz 2009, PERŞEMBE


Maven2: en İyi Kurumsal Proje (EAR dosyası)için pratik

Sadece Karınca Maven geçiş yapıyorum ve dosya KULAK tabanlı Kurumsal bir proje kurmak için en iyi yöntem anlamaya çalışıyorum?

Hadi ilgili dağıtım tanımlayıcıları ile EJBs için jar dosyası, Web katmanı ve KULAK şifrelenmiş dosya için SAVAŞ bir dosya ile oldukça standart bir proje oluşturmak istiyorum diyelim.

Bunu nasıl hakkında gitmek istiyorsunuz? ArchetypeArtifactİd ile proje=maven-archetype-web oluşturun bir savaş dosya ve genişletmek oradan benzer? En iyi proje yapısı (ve POM dosyası örneği) bunun için nedir? Nereye kulak dağıtım tanımlayıcıları, vb ilgili dosya sopa mı?

Herhangi bir yardım için teşekkürler.

CEVAP
16 Temmuz 2009, PERŞEMBE


Yeni bir proje oluşturun. Yeni projenin YEREL proje için iki bağımlılıkları ve SAVAŞ projenizi içeren KULAK derleme projenizi.

Aslında üç maven projeleri burada. Bir YEREL. Bir SAVAŞ. Tek KULAĞI, birlikte iki parça çeker ve kulak oluşturur.

Dağıtım tanımlayıcıları maven, ya da KULAK yapısı proje için kaynak dizin içine yerleştirilen oluşturulabilir.

Maven-kulak-eklenti yapılandırmak için kullanılır, ve the documentation Eğer hala maven genel olarak nasıl çalıştığını öğrenmek için iyi, ama çok net değil.

Örnek olarak şöyle bir şey yapabilirsin:

<?xml version="1.0" encoding="utf-8"?>
<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>com.mycompany</groupId>
  <artifactId>myEar</artifactId>
  <packaging>ear</packaging>
  <name>My EAR</name>

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.5</source>
          <target>1.5</target>
          <encoding>UTF-8</encoding>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-ear-plugin</artifactId>
        <configuration>
          <version>1.4</version>
          <modules>
            <webModule>
              <groupId>com.mycompany</groupId>
              <artifactId>myWar</artifactId>
              <bundleFileName>myWarNameInTheEar.war</bundleFileName>
              <contextRoot>/myWarConext</contextRoot>
            </webModule>
            <ejbModule>
              <groupId>com.mycompany</groupId>
              <artifactId>myEjb</artifactId>
              <bundleFileName>myEjbNameInTheEar.jar</bundleFileName>
            </ejbModule>
          </modules>
          <displayName>My Ear Name displayed in the App Server</displayName>
          <!-- If I want maven to generate the application.xml, set this to true -->
          <generateApplicationXml>true</generateApplicationXml>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <version>2.3</version>
        <configuration>
          <encoding>UTF-8</encoding>
        </configuration>
      </plugin>
    </plugins>
    <finalName>myEarName</finalName>
  </build>

  <!-- Define the versions of your ear components here -->
  <dependencies>
    <dependency>
      <groupId>com.mycompany</groupId>
      <artifactId>myWar</artifactId>
      <version>1.0-SNAPSHOT</version>
      <type>war</type>
    </dependency>
    <dependency>
      <groupId>com.mycompany</groupId>
      <artifactId>myEjb</artifactId>
      <version>1.0-SNAPSHOT</version>
      <type>ejb</type>
    </dependency>
  </dependencies>
</project>

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • CaptainDisillusion

    CaptainDisil

    18 EYLÜL 2007
  • FamilyFeud

    FamilyFeud

    22 AĞUSTOS 2006
  • UlyssesForever's channel

    UlyssesForev

    28 ŞUBAT 2012