void initProperties()

in src/main/java/org/apache/maven/plugins/deploy/DeployFileMojo.java [188:230]


    void initProperties() throws MojoExecutionException {
        if (pomFile == null) {
            boolean foundPom = false;
            try (JarFile jarFile = new JarFile(file)) {
                Pattern pomEntry = Pattern.compile("META-INF/maven/.*/pom\\.xml");
                Enumeration<JarEntry> jarEntries = jarFile.entries();

                while (jarEntries.hasMoreElements()) {
                    JarEntry entry = jarEntries.nextElement();

                    if (pomEntry.matcher(entry.getName()).matches()) {
                        getLog().debug("Using " + entry.getName() + " as pomFile");
                        foundPom = true;
                        String base = file.getName();
                        if (base.indexOf('.') > 0) {
                            base = base.substring(0, base.lastIndexOf('.'));
                        }
                        pomFile = new File(file.getParentFile(), base + ".pom");

                        try (InputStream pomInputStream = jarFile.getInputStream(entry)) {
                            try (OutputStream pomOutputStream = Files.newOutputStream(pomFile.toPath())) {
                                IOUtil.copy(pomInputStream, pomOutputStream);
                            }
                            processModel(readModel(pomFile));
                            break;
                        }
                    }
                }

                if (!foundPom) {
                    getLog().info("pom.xml not found in " + file.getName());
                }
            } catch (IOException e) {
                // ignore, artifact not packaged by Maven
            }
        } else {
            processModel(readModel(pomFile));
        }

        if (packaging == null && file != null) {
            packaging = getExtension(file);
        }
    }