You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

writing-consumer.apt 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. ------
  2. Writing a Consumer Plugin
  3. ------
  4. Maria Odea Ching
  5. ------
  6. 23 Nov 2007
  7. ------
  8. ~~ Licensed to the Apache Software Foundation (ASF) under one
  9. ~~ or more contributor license agreements. See the NOTICE file
  10. ~~ distributed with this work for additional information
  11. ~~ regarding copyright ownership. The ASF licenses this file
  12. ~~ to you under the Apache License, Version 2.0 (the
  13. ~~ "License"); you may not use this file except in compliance
  14. ~~ with the License. You may obtain a copy of the License at
  15. ~~
  16. ~~ http://www.apache.org/licenses/LICENSE-2.0
  17. ~~
  18. ~~ Unless required by applicable law or agreed to in writing,
  19. ~~ software distributed under the License is distributed on an
  20. ~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  21. ~~ KIND, either express or implied. See the License for the
  22. ~~ specific language governing permissions and limitations
  23. ~~ under the License.
  24. ~~ NOTE: For help with the syntax of this file, see:
  25. ~~ http://maven.apache.org/guides/mini/guide-apt-format.html
  26. Writing a Consumer Plugin
  27. For a sample custom consumer, you can checkout the archiva-consumer-plugin at the archiva sandbox in the SVN repository:
  28. +----+
  29. http://svn.apache.org/repos/asf/maven/archiva/sandbox/archiva-consumer-plugin
  30. +----+
  31. Below are the steps on how to create a custom repository consumer and plug it in Archiva:
  32. [[1]] Create a project for your component.
  33. [[2]] Declare your class or in this case, consumer as a component as shown in the example below. This
  34. should be put at the class level.
  35. +----+
  36. Ex.
  37. @plexus.component role="org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer"
  38. role-hint="discover-new-artifact"
  39. instantiation-strategy="per-lookup"
  40. where,
  41. role: the interface that your class implements
  42. role-hint: the lookup name of the component (your class/consumer)
  43. instantiation-strategy: how your class will be instantiated
  44. +----+
  45. [[3]] Make sure to add the snippet below in the <build> section of the project's pom. This is needed to
  46. generate the components.xml.
  47. +----+
  48. <plugin>
  49. <groupId>org.codehaus.plexus</groupId>
  50. <artifactId>plexus-maven-plugin</artifactId>
  51. <version>1.3.5</version>
  52. <executions>
  53. <execution>
  54. <id>generate</id>
  55. <goals>
  56. <goal>descriptor</goal>
  57. </goals>
  58. </execution>
  59. </executions>
  60. </plugin>
  61. +----+
  62. [[4]] Package your project by executing 'mvn clean package'
  63. [[5]] Let's say you are using the apache-archiva-1.0-bin.tar.gz to run Archiva. Unpack
  64. the binaries then go to bin/linux-x86-32/ (assuming you are running on Linux), then execute
  65. './run.sh console'. Then stop or shutdown Archiva after it started. (This is necessary to unpack
  66. the war file.)
  67. [[6]] Copy the jar file you created in step 4 in apache-archiva-1.0/apps/archiva/webapp/lib/
  68. [[7]] Add the necessary configurations in archiva.xml (in this case, add 'discover-new-artifact' as a
  69. <knownContentConsumer>)
  70. [[8]] Start up Archiva again.