`name` and `version` not generated
Closed this issue · 5 comments
Expected:
name
and version
are optional. If name
is not specified, the compiler gets its value automatically from the class name. When version
is omitted, compiler first try to find a file named VERSION
with version information, if the file isn't there, then, it gets the version from pom.xml
.
Getting:
I'm trying to update metadata generation logic of Brandeis Stanford services using org.lappsgrid.annotations
, where I found name
gets empty string ""
, version
gets "0.0.0.UNKNOWN"
Code:
- parent class
@org.lappsgrid.annotations.CommonMetadata(
vendor = "http://www.cs.brandeis.edu/",
license = "apache2",
allow = "any",
language = { "en" }
)
public abstract class AbstractStanfordCoreNLPWebService implements WebService {
...
}
- service class
@org.lappsgrid.annotations.ServiceMetadata(
description = "Stanford CoreNLP Coreference",
requires_format = { "text", "lif" },
produces_format = { "lif" },
produces = { "coref" }
)
public class Coreference extends AbstractStanfordCoreNLPWebService {
...
}
- result:
edu.brandeis.cs.lappsgrid.stanford.corenlp.Coreference.json
{
"$schema" : "http://vocab.lappsgrid.org/schema/service-schema-1.0.0.json",
"name" : "",
"version" : "0.0.0.UNKNOWN",
"description" : "Stanford CoreNLP Coreference",
"vendor" : "http://www.cs.brandeis.edu/",
"allow" : "http://vocab.lappsgrid.org/ns/allow#any",
"license" : "http://vocab.lappsgrid.org/ns/license#apache-2.0",
"requires" : {
"language" : [ "en" ],
"format" : [ "http://vocab.lappsgrid.org/ns/media/text", "http://vocab.lappsgrid.org/ns/media/jsonld#lif" ]
},
"produces" : {
"language" : [ "en" ],
"format" : [ "http://vocab.lappsgrid.org/ns/media/jsonld#lif" ],
"annotations" : [ "http://vocab.lappsgrid.org/Coreference" ]
}
}
pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>edu.brandeis.cs.lapps</groupId>
<artifactId>stanfordnlp-web-service</artifactId>
<version>2.1.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>Brandeis Web Services wrapping Stanford CoreNLP tools for Lappsgrid</name>
<description>
Publish API for the LAPPS exchange data structure (LEDS), the thing that will be serialized to from JSON-LD.
Provide converter for the Standford one-per-line format to LEDS.
</description>
<parent>
<artifactId>war-parent-pom</artifactId>
<groupId>org.lappsgrid.maven</groupId>
<version>2.0.4</version>
</parent>
...
name
is properly generated with 1.1.0
, but the generation of version
is not working - still getting "0.0.0.UNKNOWN".
Maybe the path to pom.xml
is not correct?
I think I just set a record for staring at a typo... Can you test the 1.1.1-SNAPSHOT?
Now getting POM_NOT_FOUND.
The problem is that MetadataProcessor
does not go into pom.xml
to find version information, unlike documented here.
Since validating the path "pom.xml"
fails, I wonder if that's a valid path from the point of jvm or maven at the runtime of MetadataProcessor
.
I've just pushed a new SNAPSHOT as you aren't even getting the correct error message anymore.
The problem was on line 288 & 289 in the original file. Line 288 declared
File pom = new File("pom.xml")
but line 289 tested
if (!file.exists()) { ... }
where file
was declared in the code above and was used to test for the VERSION file, which we know doesn't exist at that point in the code.
The pom file is expected to be found in the current working directory. So if testing from within an IDE make sure it is setting the working directory correctly. You can test on the command line by creating a VERSION file that contains a single line:
echo "foobar" > VERSION
mvn clean compile
The generated metadata files should now have foobar for the version field.
Ah, I didn't noticed that when you talked about the "typo".
The new snapshot works perfectly!
Closing this issue.