I totally agree that it makes sense for the dependency plugin to unpack the
AAR just like all other archives.

I just don't understand why you need the MDP to do so.


On Tue, Jul 22, 2014 at 10:58 PM, David Hoffer <dhoff...@gmail.com> wrote:

> No that was just an example so I could create a sample project.  Don't read
> too much into this.  They are just AAR dependencies (in my case they come
> from our build not public).  The maven dependency plugin should handle
> these no different than it handles jars/etc.
>
>
>
>
> On Mon, Jul 21, 2014 at 11:32 PM, William Ferguson <
> william.fergu...@xandar.com.au> wrote:
>
> > So an Android library is packaging WSDL inside itself and is expecting
> you
> > to use it at build time?
> >
> >
> > On Tue, Jul 22, 2014 at 8:53 AM, Martin Gainty <mgai...@hotmail.com>
> > wrote:
> >
> > > Here is an aar straight from Axis version example:
> > >
> > > //layout of version.aar:
> > >
> > >    created: META-INF/
> > >   inflated: META-INF/MANIFEST.MF
> > >    created: sample/
> > >    created: sample/axisversion/
> > >   inflated: sample/axisversion/Version.class
> > >   inflated: META-INF/services.xml
> > >
> > >
> > > //org.apache.axis2.deployment.DeploymentEngine axis code used to
> > > populateService with .aar contents:
> > >
> > >     protected ArrayList populateService(AxisServiceGroup serviceGroup,
> > >                                         URL servicesURL,
> > >                                         String serviceName) throws
> > > DeploymentException {
> > >         try {
> > >             serviceGroup.setServiceGroupName(serviceName);
> > >             ClassLoader serviceClassLoader = Utils.createClassLoader(
> > >                     new URL[]{servicesURL},
> > >                     axisConfig.getServiceClassLoader(),
> > >                     true,
> > >                     (File)
> > >
> axisConfig.getParameterValue(Constants.Configuration.ARTIFACTS_TEMP_DIR),
> > >                     axisConfig.isChildFirstClassLoading());
> > >             String metainf = "meta-inf";
> > >
> serviceGroup.setServiceGroupClassLoader(serviceClassLoader);
> > >             //processing wsdl.list
> > >             InputStream wsdlfilesStream =
> > >
> > > serviceClassLoader.getResourceAsStream("meta-inf/wsdl.list");
> > >             if (wsdlfilesStream == null) {
> > >                 wsdlfilesStream =
> > > serviceClassLoader.getResourceAsStream("META-INF/wsdl.list");
> > >                 if (wsdlfilesStream != null) {
> > >                     metainf = "META-INF";
> > >                 }
> > >             }
> > >             HashMap servicesMap = new HashMap();
> > >             if (wsdlfilesStream != null) {
> > >                 ArchiveReader reader = new ArchiveReader();
> > >                 BufferedReader input = new BufferedReader(new
> > > InputStreamReader(wsdlfilesStream));
> > >                 String line;
> > >                 while ((line = input.readLine()) != null) {
> > >                     line = line.trim();
> > >                     if (line.length() > 0 && line.charAt(0) != '#') {
> > >                         line = metainf + "/" + line;
> > >                         try {
> > >                             List services =
> > reader.getAxisServiceFromWsdl(
> > >
> > > serviceClassLoader.getResourceAsStream(line),
> > >                                     serviceClassLoader, line);
> > >                             if (services != null) {
> > >                                 for (Object service : services) {
> > >                                     AxisService axisService =
> > > (AxisService) service;
> > >
> > servicesMap.put(axisService.getName(),
> > > axisService);
> > >                                 }
> > >                             }
> > >
> > >                         } catch (Exception e) {
> > >                             throw new DeploymentException(e);
> > >                         }
> > >                     }
> > >                 }
> > >             }
> > >             InputStream servicexmlStream =
> > >
> > > serviceClassLoader.getResourceAsStream("META-INF/services.xml");
> > >             if (servicexmlStream == null) {
> > >                 servicexmlStream =
> > > serviceClassLoader.getResourceAsStream("meta-inf/services.xml");
> > >             } else {
> > >                 metainf = "META-INF";
> > >             }
> > >             if (servicexmlStream == null) {
> > >                 throw new DeploymentException(
> > >
> > > Messages.getMessage(DeploymentErrorMsgs.SERVICE_XML_NOT_FOUND,
> > >                                 servicesURL.toString()));
> > >             }
> > >             DescriptionBuilder builder = new
> > > DescriptionBuilder(servicexmlStream, configContext);
> > >             OMElement rootElement = builder.buildOM();
> > >             String elementName = rootElement.getLocalName();
> > >
> > >             if (TAG_SERVICE.equals(elementName)) {
> > >                 AxisService axisService = null;
> > >                 String wsdlLocation = "META-INF/service.wsdl";
> > >                 InputStream wsdlStream =
> > >
> > > serviceClassLoader.getResourceAsStream(wsdlLocation);
> > >                 URL wsdlURL = serviceClassLoader.getResource(metainf +
> > > "/service.wsdl");
> > >                 if (wsdlStream == null) {
> > >                     wsdlLocation = "META-INF/" + serviceName + ".wsdl";
> > >                     wsdlStream = serviceClassLoader
> > >                             .getResourceAsStream(wsdlLocation);
> > >                     wsdlURL =
> > serviceClassLoader.getResource(wsdlLocation);
> > >                 }
> > >                 if (wsdlStream != null) {
> > >                     WSDL11ToAxisServiceBuilder wsdl2AxisServiceBuilder
> =
> > >                             new WSDL11ToAxisServiceBuilder(wsdlStream,
> > > null, null);
> > >                     File file = Utils.toFile(servicesURL);
> > >                     if (file != null && file.exists()) {
> > >                         wsdl2AxisServiceBuilder.setCustomWSDLResolver(
> > >                                 new AARBasedWSDLLocator(wsdlLocation,
> > > file, wsdlStream));
> > >                         wsdl2AxisServiceBuilder.setCustomResolver(
> > >                                 new AARFileBasedURIResolver(file));
> > >                     }
> > >                     if (wsdlURL != null) {
> > >
> > > wsdl2AxisServiceBuilder.setDocumentBaseUri(wsdlURL.toString());
> > >                     }
> > >                     axisService =
> > > wsdl2AxisServiceBuilder.populateService();
> > >                     axisService.setWsdlFound(true);
> > >                     axisService.setCustomWsdl(true);
> > >                     axisService.setName(serviceName);
> > >                 }
> > >                 if (axisService == null) {
> > >                     axisService = new AxisService(serviceName);
> > >                 }
> > >
> > >                 axisService.setParent(serviceGroup);
> > >                 axisService.setClassLoader(serviceClassLoader);
> > >
> > >                 ServiceBuilder serviceBuilder = new
> > > ServiceBuilder(configContext, axisService);
> > >                 AxisService service =
> > > serviceBuilder.populateService(rootElement);
> > >
> > >                 ArrayList serviceList = new ArrayList();
> > >                 serviceList.add(service);
> > >                 return serviceList;
> > >             } else if (TAG_SERVICE_GROUP.equals(elementName)) {
> > >                 ServiceGroupBuilder groupBuilder = new
> > > ServiceGroupBuilder(rootElement, servicesMap,
> > >                         configContext);
> > >                 ArrayList servicList =
> > > groupBuilder.populateServiceGroup(serviceGroup);
> > >                 Iterator serviceIterator = servicList.iterator();
> > >                 while (serviceIterator.hasNext()) {
> > >                     AxisService axisService = (AxisService)
> > > serviceIterator.next();
> > >                     String wsdlLocation = "META-INF/service.wsdl";
> > >                     InputStream wsdlStream =
> > >
> > > serviceClassLoader.getResourceAsStream(wsdlLocation);
> > >                     URL wsdlURL =
> > > serviceClassLoader.getResource(wsdlLocation);
> > >                     if (wsdlStream == null) {
> > >                         wsdlLocation = "META-INF/" + serviceName +
> > ".wsdl";
> > >                         wsdlStream = serviceClassLoader
> > >                                 .getResourceAsStream(wsdlLocation);
> > >                         wsdlURL =
> > >
> > > serviceClassLoader.getResource(wsdlLocation);
> > >                     }
> > >                     if (wsdlStream != null) {
> > >                         WSDL11ToAxisServiceBuilder
> > wsdl2AxisServiceBuilder
> > > =
> > >                                 new
> > WSDL11ToAxisServiceBuilder(wsdlStream,
> > > axisService);
> > >                         File file = Utils.toFile(servicesURL);
> > >                         if (file != null && file.exists()) {
> > >
> > wsdl2AxisServiceBuilder.setCustomWSDLResolver(
> > >                                     new
> AARBasedWSDLLocator(wsdlLocation,
> > > file, wsdlStream));
> > >                             wsdl2AxisServiceBuilder.setCustomResolver(
> > >                                     new AARFileBasedURIResolver(file));
> > >                         }
> > >                         if (wsdlURL != null) {
> > >
> > > wsdl2AxisServiceBuilder.setDocumentBaseUri(wsdlURL.toString());
> > >                         }
> > >                         axisService =
> > > wsdl2AxisServiceBuilder.populateService();
> > >                         axisService.setWsdlFound(true);
> > >                         axisService.setCustomWsdl(true);
> > >                         // Set the default message receiver for the
> > > operations that were
> > >                         // not listed in the services.xml
> > >                         Iterator operations =
> > axisService.getOperations();
> > >                         while (operations.hasNext()) {
> > >                             AxisOperation operation = (AxisOperation)
> > > operations.next();
> > >                             if (operation.getMessageReceiver() ==
> null) {
> > >
> > > operation.setMessageReceiver(loadDefaultMessageReceiver(
> > >
> > > operation.getMessageExchangePattern(), axisService));
> > >                             }
> > >                         }
> > >                     }
> > >                 }
> > >                 return servicList;
> > >             }
> > >         } catch (IOException e) {
> > >             throw new DeploymentException(e);
> > >         } catch (XMLStreamException e) {
> > >             throw new DeploymentException(e);
> > >         }
> > >         return null;
> > >     }
> > >
> > > does this answer your question?
> > > Martin
> > > ______________
> > >
> > >
> > > > Date: Tue, 22 Jul 2014 07:56:55 +1000
> > > > Subject: Re: maven-dependency-plugin unpacking aar format?
> > > > From: william.fergu...@xandar.com.au
> > > > To: users@maven.apache.org
> > > >
> > > > David, what the use case for unpacking the AAR?
> > > >
> > > >
> > > > William
> > > >
> > > >
> > > > On Tue, Jul 22, 2014 at 7:27 AM, David Hoffer <dhoff...@gmail.com>
> > > wrote:
> > > >
> > > > > Here is a simplified project showing my use-case, I hope this
> helps.
> > >  Note
> > > > > I'm using unpack-dependencies as the aar is a module in the same
> > > project;
> > > > > however I assume the same problem exists with unpack, if that's the
> > > case
> > > > > that would make the test project even simpler.
> > > > >
> > > > > <?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/xsd/maven-4.0.0.xsd";>
> > > > >
> > > > >     <modelVersion>4.0.0</modelVersion>
> > > > >
> > > > >     <groupId>com.company.project</groupId>
> > > > >     <artifactId>service</artifactId>
> > > > >     <version>1.0-SNAPSHOT</version>
> > > > >
> > > > >     <packaging>pom</packaging>
> > > > >
> > > > >     <dependencies>
> > > > >         <!--note: maven-dependency-plug fails reporting that aar is
> > not
> > > > > supported-->
> > > > >         <dependency>
> > > > >             <groupId>com.company.project</groupId>
> > > > >             <artifactId>axis-service</artifactId>
> > > > >             <type>aar</type>
> > > > >             <version>1.0-SNAPSHOT</version>
> > > > >         </dependency>
> > > > >         <!--note: I assume it will have the same problem unpacking
> a
> > > public
> > > > > artifact such as this-->
> > > > >         <dependency>
> > > > >             <groupId>com.helpshift</groupId>
> > > > >             <artifactId>android-aar</artifactId>
> > > > >             <version>3.4.2</version>
> > > > >             <type>aar</type>
> > > > >         </dependency>
> > > > >     </dependencies>
> > > > >
> > > > >     <build>
> > > > >         <plugins>
> > > > >             <plugin>
> > > > >                 <groupId>org.apache.maven.plugins</groupId>
> > > > >                 <artifactId>maven-dependency-plugin</artifactId>
> > > > >                 <executions>
> > > > >                     <execution>
> > > > >                         <id>unpack-axis-service</id>
> > > > >                         <phase>generate-resources</phase>
> > > > >                         <goals>
> > > > >                             <goal>unpack-dependencies</goal>
> > > > >                         </goals>
> > > > >                         <configuration>
> > > > >
> > > > > <includeArtifactIds>axis-service</includeArtifactIds>
> > > > >
> > > > >
> > > > >
> > >
> >
> <outputDirectory>${project.build.directory}/generated-resources/axis</outputDirectory>
> > > > >
> > <overWriteReleases>true</overWriteReleases>
> > > > >
> > > <overWriteSnapshots>true</overWriteSnapshots>
> > > > >
> > > > > <includes>META-INF/*.wsdl,META-INF/schema/**/*.xsd</includes>
> > > > >                         </configuration>
> > > > >                     </execution>
> > > > >                 </executions>
> > > > >             </plugin>
> > > > >         </plugins>
> > > > >     </build>
> > > > >
> > > > > </project>
> > > > >
> > > > >
> > > > >
> > > > > On Mon, Jul 21, 2014 at 3:05 PM, Karl Heinz Marbaise <
> > > khmarba...@gmx.de>
> > > > > wrote:
> > > > >
> > > > > > HI David,
> > > > > >
> > > > > >
> > > > > >
> > > > > > > I'm getting the following error trying to unpack some files
> from
> > an
> > > > > aar.
> > > > > >
> > > > > >>   Is this not supported?  Is there any way to do this?
> > > > > >>
> > > > > >> Failed to execute goal
> > > > > >>
> > >
> org.apache.maven.plugins:maven-dependency-plugin:2.8:unpack-dependencies
> > > > > >> (unpack-service) on project service: Unknown archiver type: No
> > such
> > > > > >> archiver: 'aar'. -> [Help 1]
> > > > > >>
> > > > > >
> > > > > > Could you please prepare a example project which reproduces the
> > > > > > problem..so i can create a JIRA issue for this...
> > > > > >
> > > > > > Kind regards
> > > > > > Karl-Heinz Marbaise
> > > > > >
> > > > > >
> > ---------------------------------------------------------------------
> > > > > > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> > > > > > For additional commands, e-mail: users-h...@maven.apache.org
> > > > > >
> > > > > >
> > > > >
> > >
> > >
> >
>

Reply via email to