【问题标题】:is there a pip install plugin for maven?有 maven 的 pip install 插件吗?
【发布时间】:2013-08-14 07:51:25
【问题描述】:

在使用 python 的现有 java 项目中(想想 libre office 的 python 插件)

想使用 mvn 来安装一个 pypi(Python 包索引)。现在我们有解决方案,将 tar 打包到 mvn 中,然后使用 maven-dependency-plugin 解包并使用 maven-antrun-plugin 将文件移动到 python 路径(libre office python 路径)。

关于在 Linux 和 Windows 上管理此问题的更好方法有什么建议吗?理想情况下,它就像 pypi 的 maven 插件一样简单。

感谢您的任何意见。

【问题讨论】:

  • 您最终使用了什么或取得了成功?有兴趣了解您的最终解决方案
  • 嘿,请分享一下您在 pom 中使用了什么以及进一步执行以实现它..?很有趣。

标签: python maven libreoffice pypi


【解决方案1】:

不知道有没有可以安装pip包的maven插件。但是您可以做的是使用 maven-exec 插件来针对特定目标调用 pip。这是关于 exec 插件的文档http://www.mojohaus.org/exec-maven-plugin/usage.html 希望对您有所帮助

编辑:更新链接

【讨论】:

    【解决方案2】:

    我已经使用了以下内容并且它正在工作(从内部 pypi 存储库中提取)。
    注意: requirements.txt 基本上是以下输出: 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>
    

    【讨论】:

    • 我不知道我是怎么回到这里的,但这应该是公认的答案,因为它提供了一个明确的例子来说明如何做到这一点。 +1 对于 pip 命令示例。
    猜你喜欢
    • 2015-12-08
    • 2019-06-14
    • 2016-04-15
    • 2017-11-05
    • 1970-01-01
    • 2015-06-01
    相关资源
    最近更新 更多