[jbosstools-issues] [JBoss JIRA] (JBIDE-13074) The attribute lookup is undefined for the annotation type Resource.

Fred Bricon (JIRA) jira-events at lists.jboss.org
Thu Nov 15 04:37:28 EST 2012


    [ https://issues.jboss.org/browse/JBIDE-13074?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12734444#comment-12734444 ] 

Fred Bricon commented on JBIDE-13074:
-------------------------------------

This is actually covered by JBIDE-11738. If you follow the workaround described in http://jaitechwriteups.blogspot.fr/2011/02/resource-and-new-lookup-attribute-how.html you just need to :
* add a <phase> to the maven-dependency-plugin execution. This is a small bug we'll fix in JBDS 6 CR1
* right-click on project Maven > Update Project Configuration
* you might see an error marker on the maven-plugin-compiler plugin if the endorsed lib folder doesn't exist, you can quick fix it http://screencast.com/t/xRjuLJZaYHga
* also quick fix the maven-dependency-plugin error ("plugin execution not covered"), to mark the goal as ignored in your pom.xml. In [https://devstudio.jboss.com/earlyaccess/ JBDS 6.0], m2e 1.2 will be installed, so you'll be able to do that on a workspace level instead.


So your pom.xml should look like : 
{noformat}
       <plugins>
         ...
         <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>${version.compiler.plugin}</version>
            <configuration>
               <source>${maven.compiler.source}</source>
               <target>${maven.compiler.target}</target>
               <compilerArgument>-Djava.endorsed.dirs=${project.build.directory}/endorsed</compilerArgument>
            </configuration>
         </plugin>
         
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.5</version>
            <configuration>
               <!-- Setup the surefire plugin to use the endorsed directory containing
               the jar for javax.annotation.* classes. Remember that we setup this folder
               via the maven-dependency-plugin configuration, above. -->
               <argLine>-Djava.endorsed.dirs=${project.build.directory}/endorsed</argLine>
            </configuration>
         </plugin>
         
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.1</version>
            <executions>
               <execution>
                  <phase>validate</phase>
                  <goals>
                     <goal>copy</goal>
                  </goals>
                  <configuration>
                     <!-- Configure the plugin to copy the jar containing javax.annotation.*
                        to a folder named "endorsed" within the project's build directory -->
                     <artifactItems>
                        <artifactItem>
                           <groupId>org.jboss.spec.javax.annotation</groupId>
                           <artifactId>jboss-annotations-api_1.1_spec</artifactId>
                        </artifactItem>
                     </artifactItems>
                     <outputDirectory>${project.build.directory}/endorsed</outputDirectory>
                  </configuration>
               </execution>
            </executions>
         </plugin>
         ...
       </plugins>
      ...
     <pluginManagement>
      	<plugins>
      		<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
      		<plugin>
      			<groupId>org.eclipse.m2e</groupId>
      			<artifactId>lifecycle-mapping</artifactId>
      			<version>1.0.0</version>
      			<configuration>
      				<lifecycleMappingMetadata>
      					<pluginExecutions>
      						<pluginExecution>
      							<pluginExecutionFilter>
      								<groupId>
      									org.apache.maven.plugins
      								</groupId>
      								<artifactId>
      									maven-dependency-plugin
      								</artifactId>
      								<versionRange>
      									[2.1,)
      								</versionRange>
      								<goals>
      									<goal>copy</goal>
      								</goals>
      							</pluginExecutionFilter>
      							<action>
      								<ignore></ignore>
      							</action>
      						</pluginExecution>
      					</pluginExecutions>
      				</lifecycleMappingMetadata>
      			</configuration>
      		</plugin>
      	</plugins>
      </pluginManagement>
{noformat}
                
> The attribute lookup is undefined for the annotation type Resource. 
> --------------------------------------------------------------------
>
>                 Key: JBIDE-13074
>                 URL: https://issues.jboss.org/browse/JBIDE-13074
>             Project: Tools (JBoss Tools)
>          Issue Type: Bug
>          Components: maven
>            Reporter: Gary Hu
>            Assignee: Fred Bricon
>
> The attribute "lookup" is not recognized by JBDS 5 for the annotation @Resource.  
> To reproduce the issue, 
> 1) import cdi-injection quickstart into JBDS 5.0.1 as a maven project.
> 2) run maven build "eclipse:eclipse" from JBDS. 
> 3) open EnglishTranslateService.java and add the annotation @Resource(lookup="")
> It will shows the message "the attribute lookup is undefined for the annotation type Resource".
> This issue is raised in the wiki [1] in the section "Correct build path precedence errors".
> It seems that it's related to the eclipse bug [2].
> The wiki provides a workaround which works fine. However, can we provide a complete and clean fix from JBDS side?
> [1] https://community.jboss.org/wiki/HackingAS7UsingEclipse
> [2] https://bugs.eclipse.org/bugs/show_bug.cgi?id=342128

--
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


More information about the jbosstools-issues mailing list