Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 28th, 2012  |  syntax: None  |  size: 2.96 KB  |  hits: 9  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Custom file as dependency
  2. projectfoo (pom)
  3.     |- module1 (your binary dependency)
  4.     L module2 (the module that needs your dependency)
  5.        
  6. <groupId>com.dyan.sandbox</groupId>
  7. <artifactId>projectfoo</artifactId>
  8. <version>0.0.1</version>
  9. <packaging>pom</packaging>
  10.  
  11. <modules>
  12.     <module>module1</module>
  13.     <module>module2</module>
  14. </modules>
  15.        
  16. <parent>
  17.     <groupId>com.dyan.sandbox</groupId>
  18.     <artifactId>projectfoo</artifactId>
  19.     <version>0.0.1</version>
  20. </parent>
  21.  
  22. <groupId>com.dyan.sandbox.projectfoo</groupId>
  23. <artifactId>module1</artifactId>
  24. <version>0.0.1</version>
  25. <packaging>pom</packaging>
  26.  
  27. <build>
  28.     <plugins>
  29.         <plugin>
  30.             <groupId>org.apache.maven.plugins</groupId>
  31.             <artifactId>maven-assembly-plugin</artifactId>
  32.             <version>2.2</version>
  33.             <executions>
  34.                 <execution>
  35.                     <id>make-your-resource</id>
  36.                     <goals>
  37.                         <goal>single</goal>
  38.                     </goals>
  39.                     <phase>package</phase>
  40.                     <configuration>
  41.                         <descriptors>
  42.                             <descriptor>src/main/assembly/resources.xml</descriptor>
  43.                         </descriptors>
  44.                     </configuration>
  45.                 </execution>
  46.             </executions>
  47.         </plugin>
  48.     </plugins>
  49. </build>
  50.        
  51. <assembly>
  52.     <id>resources</id>
  53.     <formats>
  54.         <format>zip</format>
  55.     </formats>
  56.     <includeBaseDirectory>false</includeBaseDirectory>
  57.     <fileSets>
  58.         <fileSet>
  59.             <directory>src/main/resources/</directory>
  60.             <outputDirectory>.</outputDirectory>
  61.         </fileSet>
  62.     </fileSets>
  63. </assembly>
  64.        
  65. <groupId>com.dyan.sandbox.projectfoo</groupId>
  66. <artifactId>module2</artifactId>
  67. <version>0.0.1</version>
  68.  
  69. <dependencies>
  70.     <dependency>
  71.         <groupId>com.dyan.sandbox.projectfoo</groupId>
  72.         <artifactId>module1</artifactId>
  73.         <version>0.0.1</version>
  74.         <classifier>resources</classifier>
  75.         <type>zip</type>
  76.         <scope>provided</scope>
  77.     </dependency>
  78. </dependencies>
  79.        
  80. <build>
  81.     <plugins>
  82.         <plugin>
  83.             <groupId>org.apache.maven.plugins</groupId>
  84.             <artifactId>maven-dependency-plugin</artifactId>
  85.             <executions>
  86.                 <execution>
  87.                     <id>unpack-your-resource</id>
  88.                     <goals>
  89.                         <goal>unpack-dependencies</goal>
  90.                     </goals>
  91.                     <phase>generate-resources</phase>
  92.                     <configuration>
  93.                         <!-- unzip the resources in compilation folder -->
  94.                         <outputDirectory>${project.build.directory}/classes</outputDirectory>
  95.                         <includeArtifactIds>module1</includeArtifactIds>
  96.                         <excludeTransitive>true</excludeTransitive>
  97.                     </configuration>
  98.                 </execution>
  99.             </executions>
  100.         </plugin>
  101.     </plugins>
  102. </build>