首页 \ 问答 \ 使用Maven分类器作为依赖(Using the Maven classifier as a dependence)

使用Maven分类器作为依赖(Using the Maven classifier as a dependence)

我在工作空间中有一堆项目,每个项目都有自己的pom.xml ,它使用maven-assembly-plugin生成自己的zip和一个名为foo的分类器,如下所示:

<plugin>
    <artifactId>maven-assembly-plugin</artifactId>
    <version>2.4</version>
    <executions>
        <execution>
            <goals><goal>single</goal></goals>
            <phase>package</phase>
            <configuration>
                <classifier>foo</classifier>
                <descriptors>
                    <descriptor>foo.xml</descriptor>
                </descriptors>
            </configuration>
        </execution>
    </executions>
</plugin>

我还有一个项目,我打算用foo分类器使用maven-dependency-plugin复制上述项目中生成的所有jar,如下所示:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.9</version>
            <executions>
                <execution>
                    <id>copy</id>
                    <phase>package</phase>
                    <goals>
                        <goal>copy</goal>
                    </goals>
                    <configuration>
                        <artifactItems>
                            <artifactItem>
                                <groupId>my.group.id</groupId>
                                <artifactId>project1</artifactId>
                                <version>${project.version}</version>
                                <classifier>foo</classifier>
                                <type>zip</type>
                                <overWrite>true</overWrite>
                            </artifactItem>
                            <!-- similar artifactItem tags for project, 2, 3, etc -->
                        </artifactItems>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>
<dependencies>
    <dependency>
        <groupId>my.group.id</groupId>
        <artifactId>project1</artifactId>
        <version>${project.version}</version>
        <classifier>source</classifier>
    </dependency>
</dependencies>

但是我收到这些pom文件的错误说: 找不到Project1:jar:foo:{version} -SNAPSHOT { http:// repositoryURL }缓存在本地存储库中,解决方案将不会重新尝试,直到更新间隔为代理中心已经过去或强制更新。

我不明白为什么当我打算从本地版本中复制时maven正试图从存储库下载它。 其他项目确实生成了相应的归档。 我错过了什么或做错了什么?


I have a bunch of projects in a workspace where each project has its own pom.xml which generates its own zip with a classifier called foo using the maven-assembly-plugin as below:

<plugin>
    <artifactId>maven-assembly-plugin</artifactId>
    <version>2.4</version>
    <executions>
        <execution>
            <goals><goal>single</goal></goals>
            <phase>package</phase>
            <configuration>
                <classifier>foo</classifier>
                <descriptors>
                    <descriptor>foo.xml</descriptor>
                </descriptors>
            </configuration>
        </execution>
    </executions>
</plugin>

I have one more project where I intend to copy all of the jars generated in the above projects with the foo classifier using the maven-dependency-plugin as below:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.9</version>
            <executions>
                <execution>
                    <id>copy</id>
                    <phase>package</phase>
                    <goals>
                        <goal>copy</goal>
                    </goals>
                    <configuration>
                        <artifactItems>
                            <artifactItem>
                                <groupId>my.group.id</groupId>
                                <artifactId>project1</artifactId>
                                <version>${project.version}</version>
                                <classifier>foo</classifier>
                                <type>zip</type>
                                <overWrite>true</overWrite>
                            </artifactItem>
                            <!-- similar artifactItem tags for project, 2, 3, etc -->
                        </artifactItems>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>
<dependencies>
    <dependency>
        <groupId>my.group.id</groupId>
        <artifactId>project1</artifactId>
        <version>${project.version}</version>
        <classifier>source</classifier>
    </dependency>
</dependencies>

But I get a error with these pom files saying: Failure to find Project1:jar:foo:{version}-SNAPSHOT in {http://repositoryURL} was cached in the local repository, resolution will not be reattempted until the update interval of proxy-central has elapsed or updates are forced.

I don't understand why maven is trying to download it from the repository when I just intend to do a copy from local builds. The other projects do have the appropriate archives generated. What am I missing or doing wrong?


原文:https://stackoverflow.com/questions/35586314
更新时间:2022-04-09 10:04

最满意答案

f.write(chunk)

应该这样做(而不是f.write(1024)

正如错误消息所述, f.write需要一个字符串参数,1024显然是一个int


f.write(chunk)

should do it (instead of f.write(1024).

As the error message states, f.write expects a string parameter, and 1024 is clearly an int

相关问答

更多
  • 由于命令和文件名位于不同的行中,因此最好按行解析接收的数据。 块数据的最后部分不必以\n结束,因此必须与下一个接收的数据块合并。 这是(未经测试)按行解析接收数据的实现: data = '' # contains last line of a read block if it didn't finish with \n in_get, in_done, reading_file, ended = False, False, False, False while not ended: if len(dat ...
  • 对于问题1:发送ACK,你可以复制你反向的内容。 After many attempts to get a simple acknowledgment reply from my server this did it. Beyond literally starting completely over each round, the time.sleep(.1) function was the only missing key. It allowed the server and client both ...
  • 首先,您在这里使用TCP执行最常见的错误:假设在单个send()中发送的所有数据将在单个recv()中获得相同的结果。 这对于TCP来说是不真实的,因为它是一个八位字节流,而不是消息流。 您的代码仅在理想(实验室)条件下工作,并且可能在现实世界中使用时神秘失败。 您应该在TCP流中明确地发明消息边界,或者切换到例如SCTP。 后者现在几乎可以在任何地方使用,并通过网络连接保持消息边界。 第二个错误与第一个错误直接相关。 发送文件时,不提供文件已完成的任何明确标记。 所以,客户永远等待。 您可能尝试关闭服务器 ...
  • 不要使用UDP传输大文件,请使用TCP。 UDP不会让您发送的所有数据包都到达,或者如果它们按顺序到达,它们甚至可能被复制。 此外,UDP不适合大型传输,因为1)它没有拥塞控制,所以你只会泛滥网络,数据包将被丢弃,2)你必须将你的数据包分解成较小的数据包通常大约1400字节是建议保持在MTU以下,否则如果您依赖IP碎片并且丢失了一个片段,则整个文件都将丢失。您必须编写自定义代码来修复UDP的所有这些问题,因为文件传输需要一切都可靠地发送。 另一方面,TCP已经完成了所有这些,它是可靠的,具有拥塞控制并且无处 ...
  • 我想我可以回答我自己的问题。 事实证明,我必须更改对socket.makefile的调用以显式指定二进制模式。 即: f = self.request.makefile('b') 我认为这归结为IronPython中一个略有不同的实现。 I think I can answer my own question. It turns out that I had to change the call to socket.makefile to explicitly specify binary mode. I ...
  • 也许这会很有用: http : //www.ironpython.net/documentation/dotnet/ Maybe this will be useful: http://www.ironpython.net/documentation/dotnet/
  • 经过一些测试,我找到的最有效的解决方案是这样的: 首先,将Array [Byte]转换为python字符串: data_str = str(buffer(data)) 我不完全确定buffer是做什么的,但它似乎是高效计算所必需的, 这里有一些解释。 然后发送到cpython(在我的情况下通过套接字,cpython在linux机器上运行)并转换为元组: #data_str is an RGB image with dims sx and sy format_str = str(sx*sy*3).strip ...
  • f.write(chunk) 应该这样做(而不是f.write(1024) 。 正如错误消息所述, f.write需要一个字符串参数,1024显然是一个int f.write(chunk) should do it (instead of f.write(1024). As the error message states, f.write expects a string parameter, and 1024 is clearly an int
  • 我也用JavaScriptSerializer完成了它。 如下: peopleJson = '''[ {"name":"Jon", "age": "29", canSing:false, favColors:["red", "white"]}, {"name":"Lilly", "age": "55", "canSing": true} ]''' #convert json to string import clr clr.AddReference('System.Web.Extension ...
  • 对您对示例代码的误解表示歉意,并感谢您添加服务器和客户端调用! 请注意,您获得的错误消息与加密无关。 您可以阅读base64.py库的相关部分:错误消息指示base64数据无效。 特别是,它最后没有正确填充。 有了额外的呼叫站点信息,我认为问题在于您正在加密,然后单独编码客户端上每个1024字节的数据块。 然后,在服务器上,您正在从网络读取1024个字节并尝试解码它。 但是,base64编码会增加原始数据的长度,因此您将读取的只是编码格式的前1024个字节,这将是截断的base64消息(因此填充不正确)。 ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)