繁体   English   中英

是否有适用于 Maven 的 pip install 插件?

[英]is there a pip install plugin for maven?

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

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

关于在 Linux 和 Windows 上管理它的更好方法的任何建议? 理想情况下,它就像 pypi 的 maven 插件一样简单。

感谢您提供任何意见。

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

编辑:更新链接

我使用了以下内容并且它正在工作(从内部 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>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM