[JBoss JIRA] (FORGE-563) Create a class lookup index
by Jason Porter (JIRA)
Jason Porter created FORGE-563:
----------------------------------
Summary: Create a class lookup index
Key: FORGE-563
URL: https://issues.jboss.org/browse/FORGE-563
Project: Forge
Issue Type: Enhancement
Components: Maven Integration
Affects Versions: 1.0.4.Final
Reporter: Jason Porter
We need to support an index of classes and dependencies which contain them.
This would allow us to do wildcard expansion, and also allow facets to depend on a class, not a specific dependency. I believe Lincoln has the information about wildcard support, for the facet dependency idea my thoughts are an index like this would allow a facet to declare a class, or collection of classes, which it requires to function. For example the faces facet could depend on FacesContext, or PhaseListener or some other class. When a facet checks to see if a project has the dependencies it could match multiple jars instead one specific jar. Again in the faces example it could match Mojarra, MyFaces, JBoss spec jars, Geromino spec jars, etc.
We could keep a local cache and add to it, we could also have an online cache available which users could push to and also merge into their local cache.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 6 months
[JBoss JIRA] (FORGE-424) JavaParser does not understand wildcard imports like "javax.persistence.*"
by Lincoln Baxter III (Created) (JIRA)
JavaParser does not understand wildcard imports like "javax.persistence.*"
--------------------------------------------------------------------------
Key: FORGE-424
URL: https://issues.jboss.org/browse/FORGE-424
Project: Forge
Issue Type: Bug
Components: Parsers / File Manipulation
Affects Versions: 1.0.0.Beta5
Reporter: Lincoln Baxter III
Fix For: 1.0.0.Final
The JavaParser Annotation.getQualifiedName() will return "Column" instead of "javax.persistence.Column" for the following example class scenario. It should be able to understand the wildcard, given the proper metadata:
{code}package demo.entities;
import javax.persistence.*;
@Entity
public class Contact implements java.io.Serializable {
@Id
private @GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id", updatable = false, nullable = false)
Long id = null;
@Version
private @Column(name = "version")
int version = 0;
public Long getId() {
return this.id;
}
public void setId(final Long id) {
this.id = id;
}
public int getVersion() {
return this.version;
}
public void setVersion(final int version) {
this.version = version;
}
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
if (id != null) {
return id.equals(((Contact) that).id);
}
return super.equals(that);
}
@Override
public int hashCode() {
if (id != null) {
return id.hashCode();
}
return super.hashCode();
}
private String name;
public String getName() {
return this.name;
}
public void setName(final String name) {
this.name = name;
}
public String toString() {
return "" + name;
}
}{code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 6 months
[JBoss JIRA] (FORGE-430) Fix MavenCoreFacetImpl getPom()
by Max Schwaab (JIRA)
Max Schwaab created FORGE-430:
---------------------------------
Summary: Fix MavenCoreFacetImpl getPom()
Key: FORGE-430
URL: https://issues.jboss.org/browse/FORGE-430
Project: Forge
Issue Type: Bug
Affects Versions: 1.0.0.Beta5
Environment: Windows 7, Desktop PC
Reporter: Max Schwaab
Priority: Minor
Fix For: Future
Please have a look at org.jboss.forge.maven.facets.MavenCoreFacetImpl in the forge-project-model-maven project.
The getPom() method reads the pom directly from the file resource. This results in a warning when using maven properties for dependency versions, e.g. when you try to install a plugin via the source-plugin command (***WARNING*** Could not resolve dependency [org.some:dependency:jar::${some.version}])
The plugin works after installation and I don't know if its important to resolve this issue, but in the code is a "//FIXME"-remark too. The same may be relevant for setPOM(final Model pom) too.
{code:title=MavenCoreFacetImpl getPom()}
@Override
public Model getPOM()
{
try
{
Model result = new Model();
// FIXME this should/can-not use the Maven Native file writer if we are going to abstract file APIs
MavenXpp3Reader reader = new MavenXpp3Reader();
FileInputStream stream = new FileInputStream(getPOMFile().getUnderlyingResourceObject());
if (stream.available() > 0)
{
result = reader.read(stream);
}
stream.close();
result.setPomFile(getPOMFile().getUnderlyingResourceObject());
return result;
}
catch (IOException e)
{
throw new ProjectModelException("Could not open POM file: " + getPOMFile(), e);
}
catch (XmlPullParserException e)
{
throw new ProjectModelException("Could not parse POM file: " + getPOMFile(), e);
}
}
{code}
Example for my plugins pom.xml
{code:xml}
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
.
.
.
<properties>
<some.version>1.0</some.version>
</properties>
<dependencies>
.
.
.
<dependency>
<groupId>org.some</groupId>
<artifactId>dependency</artifactId>
<version>${some.version}</version>
</dependency>
.
.
.
</dependencies>
<repositories>
.
.
.
<repository>
<id>repository.some</id>
<name>Some Repository for Maven</name>
<url>http://some.repo.url</url>
</repository>
.
.
.
</repositories>
.
.
.
</project>
{code}
Best regards
Max
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 6 months
[JBoss JIRA] (FORGE-674) JavaPlugin: add new command 'new-interface'
by fiorenzo pizza (JIRA)
fiorenzo pizza created FORGE-674:
------------------------------------
Summary: JavaPlugin: add new command 'new-interface'
Key: FORGE-674
URL: https://issues.jboss.org/browse/FORGE-674
Project: Forge
Issue Type: Enhancement
Components: Builtin Plugins
Reporter: fiorenzo pizza
Assignee: fiorenzo pizza
javaplugin lacks an useful method to create java interfaces.
very similar to 'new-class', this is my implementation:
@Command("new-interface")
public void newInterface(
@PipeIn final InputStream in,
@Option(required = false, help = "the package in which to build this Interface", description = "source package", type = PromptType.JAVA_PACKAGE, name = "package") final String pckg,
@Option(required = false, help = "the interface definition: surround with quotes", description = "interface definition") final String... def)
throws FileNotFoundException {
JavaSourceFacet java = project.getFacet(JavaSourceFacet.class);
JavaInterface jc = null;
if (def != null) {
String classDef = Strings.join(Arrays.asList(def), " ");
jc = JavaParser.parse(JavaInterface.class, classDef);
} else if (in != null) {
jc = JavaParser.parse(JavaInterface.class, in);
} else {
throw new RuntimeException("arguments required");
}
if (pckg != null) {
jc.setPackage(pckg);
}
if (!jc.hasSyntaxErrors()) {
java.saveJavaSource(jc);
} else {
writer.println(ShellColor.RED, "Syntax Errors:");
for (SyntaxError error : jc.getSyntaxErrors()) {
writer.println(error.toString());
}
writer.println();
if (prompt.promptBoolean(
"Your class has syntax errors, create anyway?", true)) {
java.saveJavaSource(jc);
}
}
pickUp.fire(new PickupResource(java.getJavaResource(jc)));
}
i tested this and also the command 'new-method' works nicely:
@Test
public void testCreateJavaInterface() throws Exception {
getShell()
.execute(
"java new-interface --package org.jboss.forge.test.interfaces \"public interface TestingInterfaceCreation {}\"");
getShell().execute("build");
JavaInterface javaClass = (JavaInterface) getProject()
.getFacet(JavaSourceFacet.class)
.getJavaResource(
Packages.toFileSyntax("org.jboss.forge.test.interfaces.TestingInterfaceCreation"))
.getJavaSource();
assertNotNull(javaClass);
}
and
@Test
public void testCreateJavaMethodOnInterface() throws Exception {
getShell()
.execute(
"java new-interface --package org.jboss.forge.test.interfaces \"public interface TestingInterfaceCreation {}\"");
getShell().execute("java new-method \"public void testing();\"");
getShell().execute("ls");
getShell().execute("build");
JavaInterface javaClass = (JavaInterface) getProject()
.getFacet(JavaSourceFacet.class)
.getJavaResource(
Packages.toFileSyntax("org.jboss.forge.test.interfaces.TestingInterfaceCreation"))
.getJavaSource();
Method<JavaInterface> method = javaClass.getMethod("testing");
assertNotNull(method);
}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 6 months
[JBoss JIRA] (FORGE-678) forge-parser-java: JavaClassImpl with generic super type produces wrong code
by fiorenzo pizza (JIRA)
fiorenzo pizza created FORGE-678:
------------------------------------
Summary: forge-parser-java: JavaClassImpl with generic super type produces wrong code
Key: FORGE-678
URL: https://issues.jboss.org/browse/FORGE-678
Project: Forge
Issue Type: Bug
Components: Parsers / File Manipulation
Affects Versions: 1.0.6.Final
Reporter: fiorenzo pizza
forge doesn't support correctly generics.
some use case, improperly parsed:
JavaClass c1 = JavaParser.parse(JavaClass.class, "package it.coopservice.test; public class Bar<T> {}");
JavaClass javaClass = JavaParser.create(JavaClass.class);
javaClass.setName("TBarTest");
javaClass.setSuperType(c1);
javaClass.setPackage("it.coopservice.test");
javaClass.addImport("it.coopservice.test.Bar");
produces:
public class TBarTest extends Bar{}
and this:
JavaClass c0 = JavaParser.parse(JavaClass.class, "package it.coopservice.test; public class Foo {}");
JavaClass c1 = JavaParser.parse(JavaClass.class, "package it.coopservice.test; public class Bar<Foo> {}");
JavaClass javaClass = JavaParser.create(JavaClass.class);
javaClass.setName("FooBarDirectTest");
javaClass.setPackage("it.coopservice.test");
javaClass.addImport("it.coopservice.test.Bar");
javaClass.addImport("it.coopservice.test.Foo");
javaClass.setSuperType("Bar<Foo>");
produces:
java.lang.IllegalArgumentException
my complete test code and output:
https://gist.github.com/3746475
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 6 months
[JBoss JIRA] Created: (SEAMFORGE-281) Repositories are not read from parent POM hierarchy when resoliving dependencies
by Lincoln Baxter III (JIRA)
Repositories are not read from parent POM hierarchy when resoliving dependencies
--------------------------------------------------------------------------------
Key: SEAMFORGE-281
URL: https://issues.jboss.org/browse/SEAMFORGE-281
Project: Seam Forge
Issue Type: Bug
Components: Maven Integration
Affects Versions: 1.0.0.Beta1
Reporter: Lincoln Baxter III
With JBOSS_NEXUS:
{code}[metawidget-forge-scaffold] scaffold-metawidget-lib $ scaffold setup
? No scaffold type was selected, use default (Metawidget & JSF)? [Y/n]
? Scaffold provider [metawidget] is not installed. Install it? [Y/n]
Received Facet installation request [class org.metawidget.forge.MetawidgetScaffold]
Install which version of Metawidget?
1 - [org.metawidget.modules.faces:metawidget-faces:::1.15]
2 - [org.metawidget.modules.faces:metawidget-faces:::1.20]
3 - [org.metawidget.modules.faces:metawidget-faces:::1.25-SNAPSHOT]
4 - [org.metawidget.modules.faces:metawidget-faces:::1.25]
5 - [org.metawidget.modules.faces:metawidget-faces:::1.30-SNAPSHOT]
? Choose an option by typing the number of the selection:
{code}
Without JBOSS_NEXUS:
{code}[metawidget-forge-scaffold] scaffold-metawidget-lib $ scaffold setup
? No scaffold type was selected, use default (Metawidget & JSF)? [Y/n]
? Scaffold provider [metawidget] is not installed. Install it? [Y/n]
Received Facet installation request [class org.metawidget.forge.MetawidgetScaffold]
***ERROR*** [scaffold setup] promptChoice() Cannot ask user to select from a list of nothing. Ensure you have values in your options list.
org.jboss.forge.shell.exceptions.CommandExecutionException: promptChoice() Cannot ask user to select from a list of nothing. Ensure you have values in your options list.
at org.jboss.forge.shell.command.Execution.perform(Execution.java:149)
at org.jboss.forge.shell.command.fshparser.FSHRuntime.run(FSHRuntime.java:125)
at org.jboss.forge.shell.command.fshparser.FSHRuntime.run(FSHRuntime.java:63)
at org.jboss.forge.shell.ShellImpl.execute(ShellImpl.java:698)
at org.jboss.forge.shell.ShellImpl.doShell(ShellImpl.java:495)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.weld.bean.proxy.AbstractBeanInstance.invoke(AbstractBeanInstance.java:48)
at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:125)
at org.jboss.forge.shell.ShellImpl$Proxy$_$$_WeldClientProxy.doShell(ShellImpl$Proxy$_$$_WeldClientProxy.java)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:305)
at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:54)
at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:163)
at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:299)
at org.jboss.weld.introspector.jlr.WeldMethodImpl.invokeOnInstance(WeldMethodImpl.java:188)
at org.jboss.weld.introspector.ForwardingWeldMethod.invokeOnInstance(ForwardingWeldMethod.java:59)
at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:198)
at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:282)
at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:265)
at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:234)
at org.jboss.weld.manager.BeanManagerImpl.notifyObservers(BeanManagerImpl.java:635)
at org.jboss.weld.manager.BeanManagerImpl.fireEvent(BeanManagerImpl.java:622)
at org.jboss.weld.manager.BeanManagerImpl.fireEvent(BeanManagerImpl.java:616)
at org.jboss.forge.shell.Bootstrap$1.run(Bootstrap.java:83)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.forge.shell.command.Execution.perform(Execution.java:144)
... 30 more
Caused by: java.lang.IllegalArgumentException: promptChoice() Cannot ask user to select from a list of nothing. Ensure you have values in your options list.
at org.jboss.forge.shell.AbstractShellPrompt.promptChoiceTyped(AbstractShellPrompt.java:238)
at org.jboss.forge.shell.ShellImpl$Proxy$_$$_WeldClientProxy.promptChoiceTyped(ShellImpl$Proxy$_$$_WeldClientProxy.java)
at org.metawidget.forge.MetawidgetScaffoldBase.install(MetawidgetScaffoldBase.java:291)
at org.jboss.forge.project.BaseProject.performInstallation(BaseProject.java:258)
at org.jboss.forge.project.BaseProject.installFacet(BaseProject.java:172)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.weld.bean.proxy.AbstractBeanInstance.invoke(AbstractBeanInstance.java:48)
at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:125)
at org.jboss.weld.proxies.Project$-1946286523$Proxy$_$$_WeldClientProxy.installFacet(Project$-1946286523$Proxy$_$$_WeldClientProxy.java)
at org.jboss.forge.shell.project.FacetInstallationHandler.performInstallation(FacetInstallationHandler.java:121)
at org.jboss.forge.shell.project.FacetInstallationHandler.install(FacetInstallationHandler.java:97)
at org.jboss.forge.shell.project.FacetInstallationHandler.installRequest(FacetInstallationHandler.java:75)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:305)
at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:54)
at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:163)
at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:299)
at org.jboss.weld.introspector.jlr.WeldMethodImpl.invokeOnInstance(WeldMethodImpl.java:188)
at org.jboss.weld.introspector.ForwardingWeldMethod.invokeOnInstance(ForwardingWeldMethod.java:59)
at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:198)
at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:282)
at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:265)
at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:234)
at org.jboss.weld.manager.BeanManagerImpl.notifyObservers(BeanManagerImpl.java:635)
at org.jboss.weld.manager.BeanManagerImpl.fireEvent(BeanManagerImpl.java:628)
at org.jboss.weld.event.EventImpl.fire(EventImpl.java:75)
at org.jboss.forge.scaffold.plugins.ScaffoldPlugin.getScaffoldType(ScaffoldPlugin.java:186)
at org.jboss.forge.scaffold.plugins.ScaffoldPlugin.setup(ScaffoldPlugin.java:94)
... 35 more
{code}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 6 months
[JBoss JIRA] (FORGE-692) maven plugin: add "add-dependency" command
by fiorenzo pizza (JIRA)
fiorenzo pizza created FORGE-692:
------------------------------------
Summary: maven plugin: add "add-dependency" command
Key: FORGE-692
URL: https://issues.jboss.org/browse/FORGE-692
Project: Forge
Issue Type: Story
Components: Maven Integration
Reporter: fiorenzo pizza
i think we need a command to add mvn dependency, without create a specific plugin for that.
somethink like:
maven add-dependency --groupId it.flower --artifactId flowers --version 1.0.1 --scope PROVIDED
----
my code:
@Command("add-dependency")
public void addDependency(
final PipeOut out,
@Option(description = "the new groupId; for example: \"org.jboss.forge\"", name = "groupId", required = true) final String groupId,
@Option(description = "the new artifactId; for example: \"forge-parent\"", name = "artifactId", required = true) final String artifactId,
@Option(description = "the new version; for example: \"1.0.0\"", name = "version", required = false) final String version,
@Option(description = "Set the scope of the dependency: for example: \"PROVIDED\"", name = "scope", required = false, defaultValue = "PROVIDED") final ScopeType scope)
{
Assert.notNull(groupId, "GroupId must not be empty");
Assert.notNull(artifactId, "ArtifactId must not be empty");
MavenCoreFacet mvn = project.getFacet(MavenCoreFacet.class);
Model pom = mvn.getPOM();
org.apache.maven.model.Dependency dependency = new org.apache.maven.model.Dependency();
dependency.setGroupId(groupId);
dependency.setArtifactId(artifactId);
if (version != null && !artifactId.isEmpty())
dependency.setVersion(version);
if (scope != null)
dependency.setScope(scope.getScope());
else
dependency.setScope(ScopeType.PROVIDED.getScope());
pom.addDependency(dependency);
mvn.setPOM(pom);
out.println("Added dependecy: " + groupId + ":" + artifactId + ":" + version + ":" + scope.getScope());
}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 7 months