diff --git a/templates/package/content/maven.tmpl b/templates/package/content/maven.tmpl index 49ada6a3a3..7f7e3fafcc 100644 --- a/templates/package/content/maven.tmpl +++ b/templates/package/content/maven.tmpl @@ -23,49 +23,53 @@ </snapshotRepository> </distributionManagement> -
- -
<dependency>
+			{{if .PackageDescriptor.Metadata}}
+				
+ +
<dependency>
 	<groupId>{{.PackageDescriptor.Metadata.GroupID}}</groupId>
 	<artifactId>{{.PackageDescriptor.Metadata.ArtifactID}}</artifactId>
 	<version>{{.PackageDescriptor.Version.Version}}</version>
 </dependency>
-
-
- -
mvn install
-
-
- -
mvn dependency:get -DremoteRepositories= -Dartifact={{.PackageDescriptor.Metadata.GroupID}}:{{.PackageDescriptor.Metadata.ArtifactID}}:{{.PackageDescriptor.Version.Version}}
-
-
- -
+
+
+ +
mvn install
+
+
+ +
mvn dependency:get -DremoteRepositories= -Dartifact={{.PackageDescriptor.Metadata.GroupID}}:{{.PackageDescriptor.Metadata.ArtifactID}}:{{.PackageDescriptor.Version.Version}}
+
+
+ +
+ {{end}}
- {{if .PackageDescriptor.Metadata.Description}} -

{{ctx.Locale.Tr "packages.about"}}

-
- {{.PackageDescriptor.Metadata.Description}} -
- {{end}} - - {{if .PackageDescriptor.Metadata.Dependencies}} -

{{ctx.Locale.Tr "packages.dependencies"}}

-
-
- {{range .PackageDescriptor.Metadata.Dependencies}} -
- {{svg "octicon-package-dependencies" 16 ""}} -
-
{{.GroupID}}:{{.ArtifactID}}
-
{{.Version}}
-
-
- {{end}} + {{if .PackageDescriptor.Metadata}} + {{if .PackageDescriptor.Metadata.Description}} +

{{ctx.Locale.Tr "packages.about"}}

+
+ {{.PackageDescriptor.Metadata.Description}}
-
+ {{end}} + + {{if .PackageDescriptor.Metadata.Dependencies}} +

{{ctx.Locale.Tr "packages.dependencies"}}

+
+
+ {{range .PackageDescriptor.Metadata.Dependencies}} +
+ {{svg "octicon-package-dependencies" 16 ""}} +
+
{{.GroupID}}:{{.ArtifactID}}
+
{{.Version}}
+
+
+ {{end}} +
+
+ {{end}} {{end}} {{end}} diff --git a/templates/package/metadata/maven.tmpl b/templates/package/metadata/maven.tmpl index 548be61790..62573a146a 100644 --- a/templates/package/metadata/maven.tmpl +++ b/templates/package/metadata/maven.tmpl @@ -1,4 +1,4 @@ -{{if eq .PackageDescriptor.Package.Type "maven"}} +{{if and (eq .PackageDescriptor.Package.Type "maven") .PackageDescriptor.Metadata}} {{if .PackageDescriptor.Metadata.Name}}
{{svg "octicon-note" 16 "tw-mr-2"}} {{.PackageDescriptor.Metadata.Name}}
{{end}} {{if .PackageDescriptor.Metadata.ProjectURL}}
{{svg "octicon-link-external" 16 "tw-mr-2"}} {{ctx.Locale.Tr "packages.details.project_site"}}
{{end}} {{range .PackageDescriptor.Metadata.Licenses}}
{{svg "octicon-law" 16 "tw-mr-2"}} {{.}}
{{end}} diff --git a/tests/integration/api_packages_maven_test.go b/tests/integration/api_packages_maven_test.go index b6c213abcf..2fc4a0f6de 100644 --- a/tests/integration/api_packages_maven_test.go +++ b/tests/integration/api_packages_maven_test.go @@ -241,4 +241,15 @@ func TestPackageMaven(t *testing.T) { putFile(t, fmt.Sprintf("/%s/maven-metadata.xml", snapshotVersion), "test", http.StatusCreated) putFile(t, fmt.Sprintf("/%s/maven-metadata.xml", snapshotVersion), "test-overwrite", http.StatusCreated) }) + + t.Run("Partial upload", func(t *testing.T) { + defer tests.PrintCurrentTest(t)() + + partialVersion := packageVersion + "-PARTIAL" + putFile(t, fmt.Sprintf("/%s/%s", partialVersion, filename), "test", http.StatusCreated) + pkgUIURL := fmt.Sprintf("/%s/-/packages/maven/%s-%s/%s", user.Name, groupID, artifactID, partialVersion) + req := NewRequest(t, "GET", pkgUIURL) + resp := MakeRequest(t, req, http.StatusOK) + assert.NotContains(t, resp.Body.String(), "Internal server error") + }) }