stephenc / non-maven-jar-maven-plugin

A plugin for making it easier to pull a non-maven jar into your build.
Apache License 2.0
30 stars 5 forks source link

Question: what to do for many files? #2

Open paulvi opened 7 years ago

paulvi commented 7 years ago

what to do for many files that are often in lib folder?

lib-folder

While this plugin is great step to show developers right way, it is still requires moving every jar to separate folder.

I came here from https://stackoverflow.com/questions/364114/can-i-add-jars-to-maven-2-build-classpath-without-installing-them

P.S. Asked on https://stackoverflow.com/questions/45307633/maven-equivalent-for-gradle-compile-filetreedir-libs-include-jar

chabala commented 6 years ago

This is gross. I think you missed the point, this plugin is a crutch, not the right way to do anything. You have a list of versioned jars, the majority of which are in Central. Just do the work and fix your pom.

paulvi commented 6 years ago

You have a list of versioned jars, the majority of which are in Central. Just do the work and fix your pom.

And I have to do so too many times for old projects.

When creating new project to handle old jars, I would recommend now just use maven-install-plugin

<?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</groupId>
    <artifactId>3rd-parties-jars</artifactId>
    <version>1.0</version>

    <build>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-install-plugin</artifactId>
          <version>2.5.2</version>
          <executions>
            <execution>
              <id>install-ojdbc7</id>
              <phase>install</phase>
              <goals>
                <goal>install-file</goal>
              </goals>
              <configuration>
                <file>ojdbc7-12.1.0.1.0.jar</file>
                <groupId>com.oracle</groupId>
                <artifactId>ojdbc7</artifactId>
                <version>12.1.0.1.0</version>
                <packaging>jar</packaging>
              </configuration>
            </execution>
            <!-- 
            <execution>
              <id>install2</id>
              <phase>package</phase>
              <goals>
                <goal>install-file</goal>
              </goals>
              ... etc

            </execution>
            ... other executions
             -->
          </executions>
        </plugin>
      </plugins>
    </build>
  </project>

Then this non-maven-jar-maven-plugin is direction if it is possible to get and compile sources later (when modification is needed.)

wjczz commented 6 years ago

Well, if jar in question has some dependencies, then we should use this non-maven-jar-maven-plugin to define that <dependency>

paulvi commented 6 years ago

It is as well possible to create 1 project with pom.xml per jar (as README suggest), define dependency if needed (see #3 ), but use maven-install-plugin to install or deploy to LAN repository manager like Nexus.