سؤال

In an existing java project that uses python (think python plugin for libre office)

would like to use mvn to install a pypi (Python Package Index). Right now we have the solution to package the tar in mvn and then use maven-dependency-plugin to unpack and maven-antrun-plugin to move the files into the python path (the libre office python path).

Any suggestions on a better way to manage this on Linux and Windows? Ideally it would be as simple as a maven plugin for pypi.

thanks for any input.

هل كانت مفيدة؟

المحلول

I don't know if a maven plugin that can install pip package exist. But what you could do is use the maven-exec plug-in to invoke pip on a specific goal. Here is the documentation on the exec plug-in http://www.mojohaus.org/exec-maven-plugin/usage.html Hope it helped

Edit: Updated link

نصائح أخرى

I have used the following and it's working (pulling from an internal pypi repo).
NOTE: The requirements.txt is basically an output of: pip freeze > requirements.txt

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <version>1.6.0</version>
    <executions>
        <execution>
            <id>pip-install</id>
            <phase>generate-resources</phase>
            <goals>
                <goal>exec</goal>
            </goals>
            <configuration>
                <executable>pip</executable>
                <arguments>
                    <argument>install</argument>
                    <argument>-r</argument>
                    <argument>${project.basedir}/requirements.txt</argument>
                    <argument>-i</argument>
                    <argument> http://artifactoryhost.domain.com/artifactory/api/pypi/<repo-name>/simple</argument>
                    <argument>--trusted-host</argument>
                    <argument>artifactoryhost.domain.com</argument>
                </arguments>
            </configuration>
        </execution>
    </executions>
</plugin>
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top