簡體   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