我正在尝试使用ivy:publish
任务使用我理解的公共ibiblio解析器来发布我的jar,这对应于Maven中央存储库。
似乎有点工作,但我最终得到了HTTP 405: Method Not Allowed
。
我的ivysettings.xml
,ivy.xml
和build.xml
文件中的相关部分是:
这实际上是整个文件:
<ivysettings>
<settings defaultResolver="public"/>
<resolvers>
<ibiblio name="public" m2compatible="true" />
</resolvers>
</ivysettings>
...
<publications>
<artifact type="pom" ext="pom" conf="default"/>
<artifact type="jar" ext="jar" conf="default"/>
</publications>
...
...
<target name="gen-pom" depends="ivy-resolve">
<ivy:makepom ivyfile="ivy.xml" pomfile="${dist.dir}/${ant.project.name}.pom">
<mapping conf="default" scope="compile"/>
</ivy:makepom>
</target>
<target name="ivy-publish" depends="jar, gen-pom" description="publish jar/source to maven repo">
<ivy:publish resolver="public" forcedeliver="true" overwrite="true" publishivy="false">
<artifacts pattern="${dist.dir}/[artifact].[ext]" />
</ivy:publish>
</target>
...
当我调用ant ivy-publish
时,我得到:
impossible to publish artifacts for mant-tasks#mant-tasks;1.0: java.io.IOException: PUT operation to URL https://repo1.maven.org/maven2/mant-tasks/mant-tasks/1.0/mant-tasks-1.0.pom failed with status code 405: Method Not Allowed
我想这是有道理的,否则任何人都会污染命名空间。所以我的问题是:
credentials
ivysettings.xml
中的ibiblio
元素显示为in this
answer?class Form1 : Form
{
public void OnButton1_Click(object sender, EventArgs e)
{
CalculateAndDisplayBMI();
}
private void CalculateAndDisplayBMI()
{
int weight = 0;
int height = 0;
if(!TryGetWeight(out weight))
{
MessageBox.Show("Invalid value for weight.")
return;
}
if (!TryGetHeight(out height))
{
MessageBox.Show("Invalid value for height.")
return;
}
double bmi = CalculateBmi(weight, height);
bmiTxt.Text = $"{bmi}";
}
private bool TryGetWeight(out int weight)
{
if (!int.TryParse(weightTxt.Text, out weight))
return false;
if (weight <= 10 || weight >= 300) // kgs
return false;
}
private bool TryGetHeight(out int height)
{
if (!int.TryParse(heightTxt.Text, out height))
return false;
if (height <= 100 || height >= 250) // cms
return false;
}
private double CalculateBmi(int height, int weight)
{
double heightInMeters = height / 100d;
return weight / (heightInMeters * heightInMeters);
}
}
的凭据
微不足道的模块,如果没有其他免费的公众
存储库可供不想使用的Java开发人员使用
构建和维护自己的maven存储库?我需要能够从全局可用的存储库中提取我的模块(作为其他项目的IVY依赖项)。答案 0 :(得分:0)
Maven central由Maven的创造者Sonatype运营:
JFrog运营一项名为bintray的竞争服务:
我建议阅读文档并获取允许发布模块文件的凭据