You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Gary Aitken <ma...@dreamchaser.org> on 2017/01/17 00:02:39 UTC

jaxb archetype (newbie)

Trying to convert an old project from using ant to maven; having
issues getting off the ground.  I've gone through the sonatype 
maven-by-example but am pretty confused.

Starting with just a piece which will be its own project.
I want to generate a project which uses jaxb during the compile/build
phase; in ant I had to make my own ant task for one step.

Searching the central repository to find a jaxb archetype, I am
guessing com.sun.xml.bind:jaxb should work.

I tried to get a simple jaxb project laid out using 

mvn archetype:generate -DarchetypeGroupId=com.sun.xml.bind
  -DarchetypeArtifactId=jaxb

The generator came back with the full list of 1750 archetypes,
so I filtered using com.sun:
and got a short list with no com.sun.xml archetypes.
Obviously I'm doing something wrong here?

Questions:

1.  Is com.sun.xml.bind:jaxb what I want for an archetype?
2.  What's wrong with the above mvn command to generate the project?
3.  Pointers to how to convert a custom ant task into a maven goal?

Thanks for any and all clues,

Gary

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: jaxb archetype (newbie)

Posted by Curtis Rueden <ct...@wisc.edu>.
Hi Gary,

> If I'm looking for an archetype of a particular type, how do I find it?

Sorry, I do not know a good way.

> Do all archetypes have "archetype" in the group or artifact name?

I do not think it is a hard requirement, but the convention is to put
"archetype" in the artifactId [1]. And for these projects to focus on
serving the archetype and nothing else.

Note that there is an edict [2] stating that unofficial Maven plugins are
supposed to be named <foo>-maven-plugin and not maven-<foo>-plugin; I do
not know if the rule is similar regarding archetypes.

Personally, I never use archetypes. I find them confusing, and a bit
neglected in the Maven developer community. (Anecdotal evidence: even the
tutorial for creating new archetypes [3] does not use the
maven-archetype-archetype to create the new archetype, until the end as an
"alternative way"!) I find it easier to just copy and paste an existing
POM, studying each piece to understand what it does, and editing it as
needed. And most Maven tutorials I've seen are structured with that idea in
mind.

Regards,
Curtis

[1] Example project: https://github.com/maven-nar/maven-archetype-nar-lib
[2]
https://maven.apache.org/guides/plugin/guide-java-plugin-development.html
"Important Notice"
[3] https://maven.apache.org/guides/mini/guide-creating-archetypes.html
"Alternative way to start creating your Archetype"

--
Curtis Rueden
LOCI software architect - http://loci.wisc.edu/software
ImageJ2 lead, Fiji maintainer - http://imagej.net/User:Rueden


On Tue, Jan 17, 2017 at 12:20 AM, Gary Aitken <ma...@dreamchaser.org> wrote:

> Thanks;
> still in need of a clarification...
>
> >> 1.  Is com.sun.xml.bind:jaxb what I want for an archetype?
> >
> > I cannot comment on whether a good archetype for JAXB exists, since I
> > personally have not used it. But perhaps this plugin is all you need:
> >     http://www.mojohaus.org/jaxb2-maven-plugin/Documentation/v2.
> 2/index.html
>
> That's a big help.
>
> > I also found this nice blog post which might be close to what you want:
> >     http://memoverkill.com/2013/09/02/jaxb-maven-xml/
> >
> >> 2.  What's wrong with the above mvn command to generate the project?
> >
> > The artifact com.sun.xml.bind:jaxb is not a Maven archetype—just a
> regular
> > dependency of type JAR.
>
> ok, I see that if I download the pom.
> If I'm looking for an archetype of a particular type, how do I find it?
> Do all archetypes have "archetype" in the group or artifact name?
>
> >> 3.  Pointers to how to convert a custom ant task into a maven goal?
> >
> > You can use the maven-antrun-plugin:
> >     http://maven.apache.org/plugins/maven-antrun-plugin/
>
> Thanks, that will help
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: jaxb archetype (newbie)

Posted by Gary Aitken <ma...@dreamchaser.org>.
Thanks;
still in need of a clarification...

>> 1.  Is com.sun.xml.bind:jaxb what I want for an archetype?
> 
> I cannot comment on whether a good archetype for JAXB exists, since I
> personally have not used it. But perhaps this plugin is all you need:
>     http://www.mojohaus.org/jaxb2-maven-plugin/Documentation/v2.2/index.html

That's a big help.

> I also found this nice blog post which might be close to what you want:
>     http://memoverkill.com/2013/09/02/jaxb-maven-xml/
> 
>> 2.  What's wrong with the above mvn command to generate the project?
> 
> The artifact com.sun.xml.bind:jaxb is not a Maven archetype\u2014just a regular
> dependency of type JAR.

ok, I see that if I download the pom.
If I'm looking for an archetype of a particular type, how do I find it?
Do all archetypes have "archetype" in the group or artifact name?

>> 3.  Pointers to how to convert a custom ant task into a maven goal?
> 
> You can use the maven-antrun-plugin:
>     http://maven.apache.org/plugins/maven-antrun-plugin/

Thanks, that will help

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: jaxb archetype (newbie)

Posted by Curtis Rueden <ct...@wisc.edu>.
Hi Gary,

> 1.  Is com.sun.xml.bind:jaxb what I want for an archetype?

I cannot comment on whether a good archetype for JAXB exists, since I
personally have not used it. But perhaps this plugin is all you need:
    http://www.mojohaus.org/jaxb2-maven-plugin/Documentation/v2.2/index.html

I also found this nice blog post which might be close to what you want:
    http://memoverkill.com/2013/09/02/jaxb-maven-xml/

> 2.  What's wrong with the above mvn command to generate the project?

The artifact com.sun.xml.bind:jaxb is not a Maven archetype—just a regular
dependency of type JAR.

> 3.  Pointers to how to convert a custom ant task into a maven goal?

You can use the maven-antrun-plugin:
    http://maven.apache.org/plugins/maven-antrun-plugin/

Regards,
Curtis

--
Curtis Rueden
LOCI software architect - http://loci.wisc.edu/software
ImageJ2 lead, Fiji maintainer - http://imagej.net/User:Rueden


On Mon, Jan 16, 2017 at 6:02 PM, Gary Aitken <ma...@dreamchaser.org> wrote:

> Trying to convert an old project from using ant to maven; having
> issues getting off the ground.  I've gone through the sonatype
> maven-by-example but am pretty confused.
>
> Starting with just a piece which will be its own project.
> I want to generate a project which uses jaxb during the compile/build
> phase; in ant I had to make my own ant task for one step.
>
> Searching the central repository to find a jaxb archetype, I am
> guessing com.sun.xml.bind:jaxb should work.
>
> I tried to get a simple jaxb project laid out using
>
> mvn archetype:generate -DarchetypeGroupId=com.sun.xml.bind
>   -DarchetypeArtifactId=jaxb
>
> The generator came back with the full list of 1750 archetypes,
> so I filtered using com.sun:
> and got a short list with no com.sun.xml archetypes.
> Obviously I'm doing something wrong here?
>
> Questions:
>
> 1.  Is com.sun.xml.bind:jaxb what I want for an archetype?
> 2.  What's wrong with the above mvn command to generate the project?
> 3.  Pointers to how to convert a custom ant task into a maven goal?
>
> Thanks for any and all clues,
>
> Gary
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>